@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  /* Landing-page aliases — mapped onto the cool slate + blue design system
     so the marketing site and the app share one palette. */
  --ink: var(--slate-900);
  --muted: var(--slate-500);
  --paper: var(--surface-app);
  --panel: var(--surface-card);
  --line: var(--border-subtle);
  --teal: var(--blue-600);
  --teal-dark: var(--blue-700);
  --amber: var(--blue-600);
  --blue: var(--blue-600);
  --shadow: var(--shadow-xl);

  /* ============================================================
     Parquet Viewer design system — cool slate + blue data tool.
     Used by the app shell (.app-viewer-page). ============================================================ */

  /* Type families */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-sans: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Slate neutral ramp (slight blue undertone) */
  --slate-950: #0b1220;
  --slate-900: #131b2b;
  --slate-800: #1f2937;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-150: #eaeef4;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  /* Blue primary */
  --blue-50: #eff5ff;
  --blue-100: #dbe8fe;
  --blue-200: #bfd6fe;
  --blue-300: #93b8fd;
  --blue-500: #3b76ef;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;

  /* Data-type accents (Parquet logical types) */
  --type-int: #2f6fed;
  --type-float: #0d9488;
  --type-string: #16a34a;
  --type-bool: #7c3aed;
  --type-time: #be3a6b;
  --type-binary: #64748b;
  --type-nested: #6366f1;

  /* Semantic surfaces / text / lines */
  --surface-app: #f7f9fc;
  --surface-card: #ffffff;
  --surface-sunken: var(--slate-50);
  --surface-inverse: var(--slate-900);
  --surface-hover: var(--slate-100);
  --surface-selected: var(--blue-50);
  --text-strong: var(--slate-900);
  --text-body: var(--slate-700);
  --text-muted: var(--slate-500);
  --text-faint: var(--slate-400);
  --border-subtle: var(--slate-200);
  --border-default: var(--slate-300);
  --border-strong: var(--slate-400);
  --grid-line: var(--slate-150);

  /* Brand / interactive */
  --brand: var(--blue-600);
  --brand-hover: var(--blue-700);
  --brand-soft: var(--blue-50);
  --brand-soft-border: var(--blue-200);
  --accent-ring: rgba(37, 99, 235, 0.28);

  /* Status */
  --status-success: #16a34a;
  --status-warning: #d97706;
  --status-danger: #dc2626;
  --status-info: #0284c7;

  /* Radius */
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 20px;
  --radius-pill: 999px;

  /* Shadows: cool slate-tinted, low-spread (never pure black). */
  --shadow-xs: 0 1px 1px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.07), 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 18px 48px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);

  /* Motion: quick and eased, no bounce. */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 280ms;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0;
  background: rgba(247, 249, 252, 0.85);
  backdrop-filter: blur(18px);
}

.brand,
.nav,
.hero-actions,
.trust-band,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.nav {
  gap: 26px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav a:hover,
.header-cta:hover {
  color: var(--teal-dark);
}

.header-cta {
  justify-self: end;
  color: var(--teal);
  font-weight: 720;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.84fr) minmax(340px, 1.16fr);
  gap: 44px;
  width: min(1160px, calc(100% - 40px));
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding: 70px 0 48px;
  align-items: center;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--text-strong);
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(3.4rem, 7vw, 6.2rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero-lede {
  max-width: 640px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1.18rem;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 34px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 18px;
  font-family: var(--font-sans);
  font-weight: 600;
  white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.primary:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}

.button.secondary {
  background: var(--surface-card);
  color: var(--text-strong);
}

.button.secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.hero-stats div {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.hero-stats dt {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero-stats dd {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-media {
  min-width: 0;
}

.hero-media img {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.trust-band {
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 72px;
}

.trust-band span {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  padding: 8px 13px;
  color: var(--muted);
  font-size: 0.92rem;
}

.section,
.workflow,
.pricing {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 86px 0;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 36px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.feature-card,
.price-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}

.feature-card p,
.price-card li,
.workflow li {
  color: var(--muted);
}

.icon {
  display: inline-flex;
  margin-bottom: 28px;
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.workflow {
  display: grid;
  grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr);
  gap: 48px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.steps {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.steps li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.steps span {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-weight: 600;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.price-card {
  display: grid;
  gap: 18px;
  align-content: start;
}

.price-card.featured {
  border-color: var(--brand-soft-border);
  box-shadow: var(--shadow-lg);
}

.price {
  margin-bottom: 0;
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
}

.price-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
}

.price-card .button {
  justify-self: start;
}

.site-footer {
  justify-content: space-between;
  gap: 20px;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 28px 0 38px;
  color: var(--muted);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-body);
  font-family: var(--font-display);
  font-weight: 600;
}

.footer-legal {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-legal a:hover {
  color: var(--text-strong);
}

.footer-legal .footer-tagline {
  color: var(--text-faint);
}

/* ============================================================
   Legal pages (privacy, terms)
   ============================================================ */
.legal {
  width: min(800px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.legal-head {
  margin-bottom: 8px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.legal-head h1 {
  margin: 6px 0 0;
  font-size: clamp(2.3rem, 5vw, 3.3rem);
  line-height: 1.05;
}

.legal-updated {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.legal h2 {
  margin: 44px 0 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.legal-intro,
.legal p,
.legal li {
  color: var(--text-body);
  font-size: 1.02rem;
  line-height: 1.72;
}

.legal p {
  margin: 16px 0 0;
}

.legal h2 + p {
  margin-top: 14px;
}

.legal ul {
  margin: 16px 0 0;
  padding-left: 22px;
}

.legal li {
  margin-top: 8px;
}

.legal a {
  color: var(--brand);
}

.legal a:hover {
  text-decoration: underline;
}

.legal em {
  font-style: italic;
}

.legal-foot {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.viewer-page {
  background: #f4f6f4;
}

.viewer-header {
  width: min(1440px, calc(100% - 32px));
}

.viewer-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.viewer-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 18px;
}

.viewer-intro h1 {
  margin-bottom: 12px;
  font-size: clamp(2.6rem, 6vw, 5.7rem);
}

.viewer-intro p:not(.eyebrow) {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.file-drop {
  display: grid;
  align-content: center;
  min-height: 170px;
  border: 1px dashed rgba(15, 107, 99, 0.5);
  border-radius: 8px;
  background: #fff;
  padding: 24px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.file-drop:hover,
.file-drop.is-dragging {
  border-color: var(--teal);
  background: #f5fbf9;
  box-shadow: 0 14px 36px rgba(15, 107, 99, 0.12);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-drop-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 820;
}

.file-drop-meta {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.viewer-workbench {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.viewer-sidebar,
.viewer-main {
  min-width: 0;
}

.viewer-sidebar {
  display: grid;
  gap: 14px;
}

.viewer-panel,
.viewer-main {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.viewer-panel {
  padding: 16px;
}

.panel-heading,
.result-toolbar,
.query-actions {
  display: flex;
  align-items: center;
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2,
.query-bar label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-heading span,
.result-toolbar,
.empty-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.dataset-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.dataset-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.dataset-stats dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.dataset-stats dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 820;
  overflow-wrap: anywhere;
}

.schema-list,
.metadata-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.schema-item,
.metadata-item {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid #eef1ee;
  padding-bottom: 8px;
}

.schema-item span,
.metadata-item span:first-child {
  color: var(--ink);
  font-weight: 720;
  overflow-wrap: anywhere;
}

.schema-item code,
.metadata-item span:last-child {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.viewer-main {
  overflow: hidden;
}

.query-bar {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.query-bar textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
  color: var(--ink);
  font: 0.94rem/1.5 var(--font-mono);
}

.query-bar textarea:disabled {
  color: #7b8582;
}

.query-actions {
  flex-wrap: wrap;
  gap: 10px;
}

button.button {
  font: inherit;
  cursor: pointer;
}

button.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.result-toolbar {
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.table-frame {
  max-height: 68vh;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  max-width: 280px;
  border-bottom: 1px solid #edf0ed;
  border-right: 1px solid #edf0ed;
  padding: 9px 10px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8faf8;
  color: var(--ink);
  font-weight: 820;
}

.data-table td {
  color: #2b3633;
  font-family: var(--font-mono);
}

@media (max-width: 920px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .nav {
    display: none;
  }

  .hero,
  .workflow {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 48px;
  }

  .hero-media {
    order: -1;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-intro,
  .viewer-workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header,
  .hero,
  .trust-band,
  .section,
  .workflow,
  .pricing,
  .site-footer {
    width: min(100% - 28px, 1160px);
  }

  .header-cta {
    display: none;
  }

  .site-header {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  h1 {
    font-size: clamp(3.45rem, 18vw, 4.5rem);
  }

  .hero-stats,
  .feature-grid,
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .steps li {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .viewer-header,
  .viewer-shell {
    width: min(100% - 24px, 1440px);
  }

  .viewer-intro h1 {
    font-size: clamp(2.6rem, 16vw, 4rem);
  }

  .file-drop {
    min-height: 140px;
  }

  .dataset-stats {
    grid-template-columns: 1fr;
  }

  .query-actions .button {
    width: 100%;
  }

  .result-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Full-bleed app: fills the entire browser viewport, no frame. */
.app-viewer-page {
  height: 100vh;
  margin: 0;
  background: var(--surface-app);
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--text-body);
}

.app-window {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--surface-card);
}

.app-window.is-dragging {
  box-shadow: inset 0 0 0 2px var(--brand);
}

.app-titlebar,
.titlebar-actions,
.titlebar-tools,
.filter-popover-actions,
.search-control,
.mini-search,
.rail-heading,
.table-controls,
.pager-bar,
.pager-actions,
.query-actions,
.filter-popover {
  display: flex;
  align-items: center;
}

.app-titlebar {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  flex: 0 0 auto;
  min-height: 52px;
  border-bottom: 1px solid #d9e0e7;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.96);
}

.app-brand {
  color: #1c2430;
  font-size: 0.95rem;
  font-weight: 760;
  white-space: nowrap;
}

.titlebar-actions,
.titlebar-tools {
  gap: 7px;
}

.app-title {
  overflow: hidden;
  color: #1c2430;
  font-size: 0.9rem;
  font-weight: 760;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.file-picker-button,
.rail-add {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #dbe2ea;
  border-radius: 7px;
  background: #fff;
  color: #354252;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover:not(:disabled),
.icon-button.active,
.file-picker-button:hover,
.rail-add:hover {
  border-color: #9bbce8;
  background: #f5f9ff;
  color: var(--brand);
}

/* Icon + text variant used in the titlebar for discoverability. */
.icon-button.labeled,
.file-picker-button.labeled {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  font-size: 0.82rem;
  font-weight: 720;
  white-space: nowrap;
}

.filter-menu {
  position: relative;
}

.filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid #ccd7e3;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(31, 42, 54, 0.18);
}

.filter-popover[hidden] {
  display: none;
}

.filter-popover::before {
  position: absolute;
  top: -6px;
  right: 12px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  border-top: 1px solid #ccd7e3;
  border-left: 1px solid #ccd7e3;
  background: #fff;
  content: "";
}

.filter-popover label {
  display: grid;
  min-width: 0;
  flex: 1 1 120px;
  gap: 6px;
  color: #4e5c6d;
  font-size: 0.78rem;
  font-weight: 760;
}

.filter-popover select,
.filter-popover input {
  height: 34px;
  min-width: 0;
  border: 1px solid #d7dfe8;
  border-radius: 7px;
  background: #fff;
  color: #1f2a37;
  padding: 0 10px;
  font: inherit;
}

.filter-popover-actions {
  width: 100%;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

/* Lucide icons inherit currentColor; keep them from shrinking in flex toolbars. */
.app-window svg {
  flex: 0 0 auto;
}

.file-picker-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search-control,
.mini-search {
  gap: 8px;
  min-width: 0;
  border: 1px solid #dbe2ea;
  border-radius: 7px;
  background: #fff;
  color: #738092;
}

.search-control {
  width: min(320px, 22vw);
  height: 32px;
  padding: 0 10px;
}

.search-control input,
.mini-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #1c2430;
  font: inherit;
}

.viewer-workspace {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 330px;
  flex: 1;
  min-height: 0;
}

.viewer-workspace.is-left-collapsed {
  grid-template-columns: 44px minmax(0, 1fr) 330px;
}

.viewer-workspace.is-right-collapsed {
  grid-template-columns: 290px minmax(0, 1fr) 44px;
}

.viewer-workspace.is-left-collapsed.is-right-collapsed {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
}

.left-rail,
.right-rail,
.center-pane {
  min-width: 0;
  min-height: 0;
}

.left-rail,
.right-rail {
  display: grid;
  align-content: start;
  overflow: auto;
  background: #fbfcfd;
}

.left-rail {
  border-right: 1px solid #d9e0e7;
}

.right-rail {
  border-left: 1px solid #d9e0e7;
}

.rail-shell-content {
  display: grid;
  min-width: 0;
  align-content: start;
}

.rail-shell-content[hidden] {
  display: none;
}

.rail-shell-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #f6f8fa;
  color: #526174;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.rail-shell-toggle:hover {
  background: #eef4fa;
  color: var(--brand);
}

.rail-shell-toggle {
  gap: 8px;
  min-height: 34px;
  border-bottom: 1px solid #e2e7ed;
}

.rail-shell-toggle.right {
  border-bottom-color: #d9e0e7;
}

.rail-shell-toggle svg {
  color: var(--brand);
}

.left-rail.is-shell-collapsed,
.right-rail.is-shell-collapsed {
  overflow: hidden;
}

.left-rail.is-shell-collapsed .rail-shell-toggle,
.right-rail.is-shell-collapsed .rail-shell-toggle {
  width: 100%;
  min-height: 100%;
  align-items: center;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
  writing-mode: vertical-rl;
}

.right-rail.is-shell-collapsed .rail-shell-toggle {
  writing-mode: vertical-lr;
}

.rail-section,
.inspector-section {
  border-bottom: 1px solid #e2e7ed;
  padding: 16px;
}

.rail-heading,
.collapsible-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.rail-heading h2,
.inspector-section h2,
.collapsible-heading h2,
.collapsible-heading h3 {
  margin: 0;
  color: #4c596a;
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rail-heading span {
  color: #738092;
  font-size: 0.82rem;
  font-weight: 720;
}

.collapsible-heading h2,
.collapsible-heading h3 {
  min-width: 0;
  flex: 1;
}

.panel-toggle {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.panel-toggle span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapse-caret {
  width: 0;
  height: 0;
  border-top: 5px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  opacity: 0.72;
  transition: transform 140ms ease;
}

.collapsible-panel.is-collapsed .collapse-caret {
  transform: rotate(-90deg);
}

.collapsible-panel.is-collapsed .collapsible-heading {
  margin-bottom: 0;
}

.panel-meta,
.rail-heading span {
  color: #738092;
  font-size: 0.82rem;
  font-weight: 720;
}

.rail-add {
  width: 24px;
  height: 24px;
  border: 0;
  color: #687789;
  font-size: 1.25rem;
}

.dataset-list,
.schema-tree,
.partition-list {
  display: grid;
  gap: 5px;
}

.dataset-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 10px;
  background: transparent;
  color: #1f2a37;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dataset-item.active {
  background: #e8f2ff;
}

.dataset-item:hover {
  background: #eef5fb;
}

.dataset-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: #e9edf2;
  color: #354252;
  font-size: 0.78rem;
}

.dataset-item strong,
.dataset-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dataset-item strong {
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 760;
}

.dataset-item small {
  color: #657386;
  font-size: 0.8rem;
}

.empty-dataset strong {
  color: #1f2a37;
}

.mini-search {
  height: 31px;
  margin-bottom: 12px;
  padding: 0 9px;
  font-size: 0.88rem;
}

.schema-section {
  padding-bottom: 10px;
}

.schema-tree {
  max-height: 42vh;
  overflow: auto;
}

.schema-root,
.schema-item {
  display: grid;
  grid-template-columns: 18px 22px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 4px 6px;
}

.schema-root {
  grid-template-columns: 16px 22px minmax(0, 1fr);
  color: #2d3a49;
  font-size: 0.88rem;
}

.schema-item {
  cursor: pointer;
}

.schema-item:hover,
.schema-item.selected {
  background: #eef5ff;
}

.schema-item input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--brand);
}

.type-badge {
  display: inline-grid;
  min-width: 26px;
  height: 22px;
  place-items: center;
  border-radius: 5px;
  background: #dcecff;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 820;
}

.type-badge.small {
  min-width: 20px;
  height: 18px;
  font-size: 0.63rem;
}

.schema-name {
  overflow: hidden;
  color: #293545;
  font-size: 0.86rem;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schema-item code {
  overflow: hidden;
  max-width: 118px;
  color: #637083;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partition-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-radius: 6px;
  padding: 5px 7px;
  color: #526174;
  font-size: 0.84rem;
}

.partition-item strong {
  color: #1f2a37;
}

.center-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  background: #fff;
}

.table-controls {
  gap: 22px;
  min-height: 58px;
  border-bottom: 1px solid #e2e7ed;
  padding: 10px 16px;
}

.table-controls label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #4e5c6d;
  font-size: 0.86rem;
  font-weight: 720;
}

.table-controls select {
  height: 34px;
  min-width: 92px;
  border: 1px solid #d7dfe8;
  border-radius: 7px;
  background: #fff;
  color: #1f2a37;
  font: inherit;
}

.table-controls select {
  padding: 0 32px 0 10px;
}

.table-total {
  margin-left: auto;
  color: #667386;
  font-size: 0.88rem;
}

.compact-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #d7dfe8;
  border-radius: 7px;
  background: #fff;
  color: #273444;
  padding: 0 12px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 760;
  cursor: pointer;
}

.compact-button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.compact-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-table-frame {
  position: relative;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.table-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 10px;
  border: 1px solid #f1c9c2;
  border-radius: 8px;
  padding: 9px 12px;
  background: #fdf2f0;
  color: #a23b2b;
  font-size: 0.83rem;
  font-weight: 660;
}

.table-error svg {
  flex: 0 0 auto;
}

.spin {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-data-table {
  min-width: 920px;
  color: #202b39;
  font-size: 0.86rem;
}

.app-data-table th,
.app-data-table td {
  max-width: 260px;
  border-color: #e5e9ee;
  padding: 8px 12px;
}

.app-data-table th {
  top: 0;
  height: 48px;
  background: #fbfcfd;
  vertical-align: bottom;
  cursor: pointer;
}

.app-data-table th span,
.app-data-table th small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-data-table th small {
  margin-top: 1px;
  color: #7a8798;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.app-data-table th.selected-column {
  background: #f1f7ff;
  color: var(--brand);
}

.row-index-header,
.row-index {
  width: 54px;
  min-width: 54px;
  max-width: 54px;
  background: #fbfcfd;
  color: #6d7a8b;
  text-align: center;
}

.row-index {
  position: sticky;
  left: 0;
  z-index: 1;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.row-index-header {
  left: 0;
  z-index: 2;
}

.null-cell {
  color: #a0a8b4;
  font-style: italic;
}

.sort-indicator {
  float: right;
  color: var(--brand);
}

.pager-bar {
  justify-content: space-between;
  gap: 16px;
  min-height: 50px;
  border-top: 1px solid #e2e7ed;
  padding: 8px 16px;
  color: #5f6d7f;
  font-size: 0.87rem;
}

.pager-actions {
  gap: 8px;
}

.pager-actions .icon-button {
  width: 34px;
  height: 34px;
}

.sql-drawer {
  border-top: 1px solid #e2e7ed;
  background: #fbfcfd;
}

.sql-drawer summary {
  cursor: pointer;
  padding: 10px 16px;
  color: #4c596a;
  font-size: 0.8rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sql-drawer textarea {
  width: calc(100% - 32px);
  min-height: 96px;
  margin: 0 16px 10px;
  resize: vertical;
  border: 1px solid #d7dfe8;
  border-radius: 7px;
  padding: 10px;
  background: #fff;
  color: #1f2a37;
  font: 0.86rem/1.5 var(--font-mono);
}

.sql-drawer .query-actions {
  gap: 8px;
  padding: 0 16px 14px;
}

.inspector-summary {
  display: grid;
  gap: 14px;
}

.summary-section {
  min-width: 0;
}

.summary-section h3 {
  margin: 0 0 6px;
  color: #637083;
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-list,
.stats-list {
  display: grid;
  gap: 5px;
  margin: 0;
}

.summary-list div,
.stats-list div {
  display: grid;
  grid-template-columns: minmax(72px, 0.7fr) minmax(0, 1fr);
  gap: 10px;
}

.summary-list dt,
.stats-list dt {
  color: #657386;
  font-size: 0.8rem;
}

.summary-list dd,
.stats-list dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #1f2a37;
  font-size: 0.8rem;
  font-weight: 660;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-column {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

.inspector-column strong,
.inspector-column small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-column strong {
  color: #202b39;
  font-size: 0.95rem;
}

.inspector-column small {
  color: #657386;
  font-size: 0.82rem;
}

.inspector-section .stats-list {
  margin-top: 14px;
}

.histogram {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 86px;
  margin-top: 14px;
}

.histogram span {
  flex: 1;
  min-width: 3px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #7db6f4, #3f83d8);
}

.top-values {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.top-value-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  color: #293545;
  font-size: 0.84rem;
}

.top-value-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-value-item strong {
  color: #536174;
  font-weight: 660;
  white-space: nowrap;
}

.empty-note {
  margin: 0;
  color: #738092;
  font-size: 0.86rem;
}

@media (max-width: 1180px) {
  .app-window {
    height: 100vh;
  }

  .viewer-workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .viewer-workspace.is-left-collapsed {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .viewer-workspace.is-right-collapsed,
  .viewer-workspace.is-left-collapsed.is-right-collapsed {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .viewer-workspace.is-left-collapsed.is-right-collapsed {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid #d9e0e7;
    border-left: 0;
  }

  .right-rail .rail-shell-toggle {
    grid-column: 1 / -1;
  }

  .right-rail .rail-shell-content {
    display: contents;
  }

  .right-rail .rail-shell-content[hidden] {
    display: none;
  }

  .right-rail.is-shell-collapsed {
    min-height: 38px;
  }

  .right-rail.is-shell-collapsed .rail-shell-toggle {
    min-height: 38px;
    flex-direction: row;
    gap: 8px;
    writing-mode: horizontal-tb;
  }

}

@media (max-width: 820px) {
  .app-window {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .app-titlebar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    height: auto;
    min-height: 58px;
  }

  .app-brand {
    display: none;
  }

  .titlebar-tools {
    gap: 5px;
  }

  .filter-popover {
    position: fixed;
    top: 54px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .filter-popover::before {
    display: none;
  }

  .search-control {
    width: 150px;
  }

  .viewer-workspace {
    grid-template-columns: 1fr;
  }

  .viewer-workspace.is-left-collapsed,
  .viewer-workspace.is-right-collapsed,
  .viewer-workspace.is-left-collapsed.is-right-collapsed {
    grid-template-columns: 1fr;
  }

  .left-rail,
  .right-rail {
    max-height: none;
    border-right: 0;
    border-left: 0;
  }

  .left-rail.is-shell-collapsed,
  .right-rail.is-shell-collapsed {
    min-height: 38px;
  }

  .left-rail.is-shell-collapsed .rail-shell-toggle,
  .right-rail.is-shell-collapsed .rail-shell-toggle {
    min-height: 38px;
    flex-direction: row;
    gap: 8px;
    writing-mode: horizontal-tb;
  }

  .schema-tree {
    max-height: 260px;
  }

  .center-pane {
    min-height: 660px;
  }

  .table-controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .table-total {
    width: 100%;
    margin-left: 0;
  }

  .right-rail {
    grid-template-columns: 1fr;
  }
}

/* Access-code / credits control */
.access-code-status {
  margin: 0;
  color: #4e5c6d;
  font-size: 0.78rem;
}

.access-code-status.muted {
  color: #8a96a5;
}

.access-code-status code {
  color: #1f2a37;
  font-size: 0.78rem;
}

.access-code-error {
  margin: 0;
  color: #c0392b;
  font-size: 0.78rem;
  font-weight: 760;
}

.access-code-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Limited-mode banner + inline hint */
.limited-banner-region {
  border-bottom: 1px solid #f0d9a8;
  background: #fdf6e6;
}

.limited-banner {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: #8a6d18;
  font-size: 0.82rem;
  font-weight: 760;
}

.query-hint {
  align-self: center;
  color: #8a6d18;
  font-size: 0.78rem;
  font-weight: 760;
}

/* --- Table toolbar: controls + active chips --- */
.table-toolbar {
  border-bottom: 1px solid #e2e7ed;
}

.table-toolbar .table-controls {
  border-bottom: 0;
}

.active-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
}

.clear-all-chip {
  margin-left: 2px;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  border: 1px solid #cfe0f4;
  border-radius: 999px;
  padding: 3px 4px 3px 11px;
  background: #f1f7ff;
  color: #1c4e86;
  font-size: 0.8rem;
  font-weight: 660;
}

.active-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-chip button {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4f7bb0;
  font: inherit;
  font-size: 0.74rem;
  line-height: 1;
  cursor: pointer;
}

.active-chip button:hover {
  background: #dbe9fb;
  color: #1c4e86;
}

/* --- Column header: label + sort + actions menu --- */
.app-data-table th {
  cursor: default;
}

.th-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.th-label {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-data-table th .th-name {
  font-weight: 820;
}

.app-data-table th .sort-indicator {
  display: inline-block;
  flex: 0 0 auto;
  float: none;
  overflow: visible;
  color: var(--brand);
  font-weight: 820;
}

.column-menu-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8a97a8;
  font: inherit;
  line-height: 1;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 120ms ease, background 120ms ease;
}

.th-inner:hover .column-menu-button,
.column-menu-button:hover,
.column-menu-button:focus-visible,
.column-menu-button[aria-expanded="true"] {
  background: #e9f1fc;
  color: var(--brand);
  opacity: 1;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  border: 0;
  background: transparent;
  cursor: default;
}

.column-menu {
  position: fixed;
  z-index: 901;
  display: flex;
  min-width: 172px;
  flex-direction: column;
  transform: translateX(-100%);
  border: 1px solid #ccd7e3;
  border-radius: 8px;
  padding: 4px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(31, 42, 54, 0.2);
}

.column-menu button {
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  background: transparent;
  color: #273444;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.column-menu button:hover {
  background: #eef5ff;
  color: var(--brand);
}

.column-menu button.danger:hover {
  background: #fdeceb;
  color: #c0392b;
}

/* --- Data cells become clickable for the detail drawer --- */
.app-data-table .data-cell {
  cursor: pointer;
}

/* --- Cell / row detail drawer --- */
.cell-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 30, 0.42);
}

.cell-detail {
  display: flex;
  width: min(560px, 100%);
  max-height: 82vh;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #ccd7e3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 30, 0.32);
}

.cell-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e7ed;
  padding: 12px 14px;
  color: #1f2a37;
}

.cell-detail-head strong {
  font-size: 0.95rem;
}

.cell-detail-focus {
  border-bottom: 1px solid #e2e7ed;
  padding: 14px;
}

.cell-detail-label {
  margin-bottom: 6px;
  color: #637083;
  font-size: 0.74rem;
  font-weight: 820;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cell-detail-value {
  max-height: 200px;
  margin: 0 0 12px;
  overflow: auto;
  border: 1px solid #e5e9ee;
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfd;
  color: #1f2a37;
  font: 0.86rem/1.5 var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.cell-detail-value.is-null {
  color: #a0a8b4;
  font-style: italic;
}

.cell-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cell-detail-row {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.cell-detail-rowhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #4c596a;
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cell-detail-fields {
  display: grid;
  gap: 1px;
  margin: 0;
  background: #eef1f5;
  border: 1px solid #eef1f5;
  border-radius: 7px;
  overflow: hidden;
}

.cell-detail-fields > div {
  display: grid;
  grid-template-columns: minmax(96px, 0.4fr) minmax(0, 1fr);
  gap: 12px;
  padding: 7px 10px;
  background: #fff;
}

.cell-detail-fields > div.is-focused {
  background: #f1f7ff;
}

.cell-detail-fields dt {
  color: #657386;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.cell-detail-fields dd {
  margin: 0;
  color: #1f2a37;
  font-size: 0.8rem;
  font-weight: 620;
  overflow-wrap: anywhere;
}

/* --- Schema select all / none --- */
.schema-actions {
  display: inline-flex;
  gap: 4px;
}

.text-button {
  border: 0;
  border-radius: 5px;
  padding: 2px 7px;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 760;
  cursor: pointer;
}

.text-button:hover {
  background: #eef5ff;
}

/* --- Center-pane empty state --- */
.center-pane.is-empty {
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: 24px;
}

.center-empty {
  display: grid;
  width: 100%;
  max-width: 520px;
  place-items: center;
}

.center-dropzone {
  display: grid;
  width: 100%;
  justify-items: center;
  gap: 8px;
  border: 1.5px dashed #b9c8d8;
  border-radius: 12px;
  padding: 44px 28px;
  background: #fbfcfd;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.center-dropzone:hover {
  border-color: var(--brand);
  background: #f5f9ff;
}

.center-dropzone-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 12px;
  background: #e9edf2;
  color: #4a586a;
  font-size: 1.4rem;
}

.center-dropzone-title {
  color: #1f2a37;
  font-size: 1.05rem;
  font-weight: 820;
}

.center-dropzone-hint {
  max-width: 360px;
  color: #657386;
  font-size: 0.9rem;
}

.center-dropzone-hint code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

/* =====================================================================
   Redesigned viewer shell — TopBar · Sidebar · Tabbed main · Status bar
   ===================================================================== */

/* App-scoped eyebrow (overrides the teal landing-page .eyebrow). */
.app-window .eyebrow {
  margin: 0;
  color: #6b7686;
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- TopBar --- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid #d9e0e7;
  background: #fff;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.top-brand:hover {
  opacity: 0.8;
}

.brand-logo {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.top-bar .app-brand {
  color: #1c2430;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.top-divider {
  width: 1px;
  height: 22px;
  background: #dce3ea;
}

.file-chip-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #1c2430;
  cursor: pointer;
}

.file-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.file-close:hover {
  background: var(--surface-sunken);
  color: var(--text-strong);
}

.file-chip:hover {
  background: #f5f9ff;
  border-color: #dbe7f5;
}

.file-chip svg {
  color: var(--brand);
  flex: 0 0 auto;
}

.file-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-chip-name {
  overflow: hidden;
  font: 600 0.85rem var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-name.muted {
  color: #738092;
  font-weight: 500;
}

.file-chip-size {
  color: #8a96a5;
  font: 0.8rem var(--font-mono);
}

.top-spacer {
  flex: 1;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid #bfe2c6;
  border-radius: 999px;
  background: #f1faf2;
  color: #1f8a3b;
  font-size: 0.78rem;
  font-weight: 720;
  white-space: nowrap;
}

.local-badge svg {
  flex: 0 0 auto;
}

/* --- Body split: sidebar + main --- */
.viewer-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.viewer-sidebar {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: 290px;
  min-height: 0;
  border-right: 1px solid #d9e0e7;
  background: #fbfcfd;
}

.viewer-sidebar.is-collapsed {
  width: 44px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}

.sidebar-collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.sidebar-collapse-toggle:hover {
  background: var(--surface-hover);
  color: var(--text-strong);
}

.sidebar-rail-icon {
  color: var(--text-faint);
}

.sidebar-rail-label {
  writing-mode: vertical-rl;
  font: 760 0.62rem var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.sidebar-head {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid #e2e7ed;
}

.sidebar-head-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-head-row .schema-actions {
  margin-left: auto;
}

.sidebar-head-row .schema-actions + .sidebar-collapse-toggle {
  margin-left: 0;
}

.sidebar-head-row .sidebar-collapse-toggle {
  margin-left: auto;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef1f5;
  color: #4c596a;
  font-size: 0.74rem;
  font-weight: 760;
}

.count-badge.mono {
  font-family: var(--font-mono);
}

.sidebar-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px;
}

.column-row {
  display: grid;
  grid-template-columns: 16px 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
}

.column-row:hover,
.column-row.selected {
  background: #eef5ff;
}

.column-row.selected {
  box-shadow: inset 2px 0 0 var(--brand);
}

.column-row input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--brand);
}

.column-name {
  overflow: hidden;
  color: #1f2a37;
  font: 600 0.84rem var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-row code {
  overflow: hidden;
  max-width: 92px;
  color: #8a96a5;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-meta {
  flex: 0 0 auto;
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid #e2e7ed;
  background: #f4f6f9;
}

.sidebar-meta div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font: 0.78rem var(--font-mono);
}

.sidebar-meta dt {
  color: #8a96a5;
}

.sidebar-meta dd {
  margin: 0;
  color: #3a4654;
  font-weight: 600;
}

/* --- Main pane: tabs --- */
.main-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.tabbar {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-bottom: 1px solid #e2e7ed;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #5f6d7f;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 720;
  cursor: pointer;
}

.tab:hover {
  color: #1c2430;
}

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef1f5;
  color: #6b7686;
  font: 600 0.72rem var(--font-mono);
}

.tab.active .tab-count {
  background: #e3eefc;
  color: var(--brand);
}

/* --- Main toolbar --- */
.main-toolbar-wrap {
  flex: 0 0 auto;
  border-bottom: 1px solid #e2e7ed;
}

.main-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: #e2e7ed;
}

.inline-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #5f6d7f;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.inline-control select {
  height: 32px;
  border: 1px solid #d7dfe8;
  border-radius: 7px;
  background: #fff;
  color: #1f2a37;
  padding: 0 8px;
  font: inherit;
  font-size: 0.82rem;
}

.chips-label {
  margin-right: 2px !important;
}

/* --- Tab content area --- */
.tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-content > .app-table-frame {
  flex: 1;
}

.tab-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #f7f9fb;
}

.empty-note.pad {
  padding: 8px 2px;
}

/* --- Schema tab --- */
.schema-card {
  max-width: 920px;
  margin: 0 auto;
  border: 1px solid #e2e7ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 42, 54, 0.05);
  overflow: hidden;
}

.schema-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.schema-table th {
  padding: 11px 16px;
  border-bottom: 1px solid #dce3ea;
  color: #8a96a5;
  font-size: 0.7rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.schema-table td {
  padding: 9px 16px;
  border-bottom: 1px solid #eef1f5;
  color: #3a4654;
}

.schema-table tbody tr {
  cursor: pointer;
}

.schema-table tbody tr:hover {
  background: #f5f9ff;
}

.schema-table tbody tr.selected {
  background: #eef5ff;
}

.schema-col-name {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #1f2a37;
  font: 600 0.85rem var(--font-mono);
}

.schema-table code {
  color: #5f6d7f;
  font-size: 0.78rem;
}

/* --- Statistics tab --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 940px;
  margin: 0 auto;
}

.stat-card {
  border: 1px solid #e2e7ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 42, 54, 0.05);
  padding: 14px 16px;
}

.stat-card-wide {
  grid-column: 1 / -1;
}

.stat-card h3 {
  margin: 0 0 10px;
  color: #6b7686;
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-card .inspector-column {
  margin: 0;
}

/* --- SQL tab --- */
.sql-tab {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 14px;
  padding: 16px 18px;
  background: #f7f9fb;
}

.sql-editor-card,
.sql-result-card {
  border: 1px solid #e2e7ed;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 42, 54, 0.05);
  overflow: hidden;
}

.sql-editor-card {
  flex: 0 0 auto;
}

.sql-result-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.sql-editor-head,
.sql-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #e2e7ed;
  background: #fbfcfd;
}

.sql-editor-hint,
.sql-result-status {
  margin-left: auto;
  color: #8a96a5;
  font: 0.74rem var(--font-mono);
}

.sql-editor-input {
  display: block;
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 12px 14px;
  background: #fff;
  color: #1f2a37;
  font: 0.86rem/1.6 var(--font-mono);
  tab-size: 2;
}

.sql-run-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid #e2e7ed;
}

.sql-run-spacer {
  flex: 1;
}

.sql-kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #8a96a5;
  font-size: 0.76rem;
}

.sql-kbd-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border: 1px solid #d7dfe8;
  border-radius: 4px;
  background: #f4f6f9;
  color: #5f6d7f;
  font: 0.7rem var(--font-mono);
}

.sql-result-card .table-frame {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* --- Status bar --- */
.status-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  height: 28px;
  padding: 0 14px;
  background: var(--surface-inverse);
  color: var(--slate-400);
  font: 0.72rem var(--font-mono);
}

.status-local {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue-300);
}

.status-spacer {
  flex: 1;
}

/* --- Full-screen empty state (no file) --- */
.viewer-empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 32px;
  background: #f7f9fb;
}

.empty-card {
  width: 560px;
  max-width: 100%;
  text-align: center;
}

.empty-logo {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
}

.empty-title {
  margin: 0 0 10px;
  color: #1c2430;
  font-size: 1.7rem;
  font-weight: 820;
  letter-spacing: -0.02em;
}

.empty-lede {
  max-width: 400px;
  margin: 0 auto 24px;
  color: #5f6d7f;
  font-size: 1rem;
}

.empty-dropzone {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 28px;
  border: 1.5px dashed #b9c8d8;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.empty-dropzone:hover {
  border-color: var(--brand);
  background: #f5f9ff;
}

.empty-dropzone-icon {
  display: grid;
  place-items: center;
  color: #8a96a5;
}

.empty-dropzone-title {
  color: #1f2a37;
  font-size: 0.98rem;
  font-weight: 720;
}

.empty-dropzone-title code,
.empty-dropzone-hint code {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--brand);
}

.empty-dropzone-hint {
  color: #738092;
  font-size: 0.86rem;
}

.empty-assurances {
  display: flex;
  gap: 22px;
  justify-content: center;
  margin-top: 22px;
  color: #8a96a5;
  font: 0.78rem var(--font-mono);
}

.empty-assurances span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.empty-access {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
  padding: 16px;
  border: 1px solid #e2e7ed;
  border-radius: 12px;
  background: #fff;
  text-align: left;
}

.empty-access-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4e5c6d;
  font-size: 0.82rem;
  font-weight: 760;
}

.empty-access-credits {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 9px;
  background: #f1faf2;
  color: #1f8a3b;
  font-size: 0.76rem;
  font-weight: 760;
}

.empty-access-row {
  display: flex;
  gap: 8px;
}

.empty-access-row input {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  border: 1px solid #d7dfe8;
  border-radius: 7px;
  background: #fff;
  color: #1f2a37;
  padding: 0 10px;
  font: inherit;
  letter-spacing: 0.04em;
}

.empty-access .access-code-status,
.empty-access .access-code-error {
  margin: 0;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .viewer-sidebar {
    width: 240px;
  }

  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .local-badge {
    display: none;
  }
}

/* ============================================================
   Design-system refinements: display type + per-type coding
   ============================================================ */

.app-viewer-page .app-brand,
.app-viewer-page .empty-title {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Type-coded dot (Parquet logical type). */
.type-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--type-string);
}

.type-dot[data-type="int"] { background: var(--type-int); }
.type-dot[data-type="float"] { background: var(--type-float); }
.type-dot[data-type="string"] { background: var(--type-string); }
.type-dot[data-type="bool"] { background: var(--type-bool); }
.type-dot[data-type="time"] { background: var(--type-time); }
.type-dot[data-type="binary"] { background: var(--type-binary); }
.type-dot[data-type="nested"] { background: var(--type-nested); }

/* Type-coded cell values; nulls stay faint + italic via .null-cell. */
.app-data-table td.data-cell[data-type="int"] { color: var(--type-int); }
.app-data-table td.data-cell[data-type="float"] { color: var(--type-float); }
.app-data-table td.data-cell[data-type="string"] { color: var(--type-string); }
.app-data-table td.data-cell[data-type="bool"] { color: var(--type-bool); }
.app-data-table td.data-cell[data-type="time"] { color: var(--type-time); }
.app-data-table td.data-cell[data-type="binary"] { color: var(--type-binary); }
.app-data-table td.data-cell[data-type="nested"] { color: var(--type-nested); }
.app-data-table td.data-cell.null-cell { color: var(--text-faint); }

/* Tabular figures right-align for aligned numeric reading. */
.app-data-table td.data-cell[data-type="int"],
.app-data-table td.data-cell[data-type="float"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Stat-card header dot. */
.stat-card .inspector-column {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

/* ============================================================
   Embedded SQL editor — collapsible "Query" bar in the Data tab
   ============================================================ */

.sql-embed {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-card);
}

/* Expanded editor fills the bar width. */
.sql-embed .sql-editor-card {
  flex: 1;
  min-width: 0;
}

/* Collapsed — a single query line that expands on click. */
.sql-embed-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-app);
  color: var(--text-muted);
  text-align: left;
  cursor: text;
}

.sql-embed-trigger:hover {
  border-color: var(--border-strong);
}

.sql-embed-trigger svg {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.sql-embed-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font: 0.82rem var(--font-mono);
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sql-embed-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.sql-embed-collapse:hover {
  background: var(--surface-hover);
}

.sql-embed-code {
  display: flex;
  background: var(--surface-card);
}

.sql-embed-gutter {
  flex: 0 0 auto;
  padding: 12px 0;
  border-right: 1px solid var(--grid-line);
  text-align: right;
  user-select: none;
}

.sql-embed-gutter div {
  padding: 0 12px;
  font: 0.86rem/1.6 var(--font-mono);
  color: var(--text-faint);
}

.sql-embed-input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 0;
  outline: 0;
  padding: 12px 14px;
  background: transparent;
  color: var(--text-strong);
  font: 0.86rem/1.6 var(--font-mono);
  tab-size: 2;
}
