:root {
  --bg: #171b22;
  --bg-soft: #1f242d;
  --panel: #1b1f27;
  --panel-strong: #121721;
  --panel-alt: #202733;
  --border: #2d3748;
  --border-soft: #39445a;
  --text: #ecf1ff;
  --muted: #9aa7bd;
  --sidebar-text: #d7ddea;
  --accent: #534AB7;
  --accent-dark: #3C3489;
  --accent-soft: #EEEDFE;
  --accent-glow: rgba(83, 74, 183, 0.35);
  --danger: #f87171;
  --success: #4ade80;
  --shadow: rgba(0, 0, 0, 0.35);
  --sidebar-width: 330px;
  --details-width: 260px;
  --editor-height: 260px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  padding: 18px;
}

.auth-screen {
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(100%, 390px);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: 0 24px 60px var(--shadow);
  text-align: center;
}

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

.auth-card h1 {
  margin: 6px 0 24px;
  color: var(--text);
  font-size: 1.8rem;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--sidebar-text);
  font-size: 0.8rem;
  text-align: left;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  padding: 11px 12px;
}

.login-form input:focus {
  outline: 2px solid var(--accent-glow);
  border-color: var(--accent);
}

.login-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
}

.auth-link {
  display: block;
  margin: 18px auto 0;
  border: 0;
  background: transparent;
  color: var(--accent-soft);
  font-size: 0.82rem;
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-columns: var(--sidebar-width) 8px minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px var(--shadow);
}

.sidebar {
  min-width: 0;
  background: var(--panel-strong);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar > *,
.connection-form,
.connection-form label,
.schema-box {
  min-width: 0;
}

.brand-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 12px;
}

.brand-home {
  display: block;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
}

.brand-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: block;
  object-fit: contain;
}

.brand-row > div {
  min-width: 0;
  overflow: hidden;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  
  /* Pixel-accurate Figma export */
  body:has(.figma-stage) { padding: 0; background: #0d1015; }
  font-size: 1.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 8px;
}

.connection-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.connection-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--sidebar-text);
  font-size: 0.78rem;
}

.connection-form input {
  min-width: 0;
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
}

.connection-form input:focus {
  outline: 2px solid var(--accent-glow);
  border-color: var(--accent);
}

.primary-btn,
.ghost-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  transition: 0.18s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--accent-soft);
  font-weight: 600;
}

.primary-btn:hover,
.ghost-btn:hover {
  filter: brightness(1.06);
}

.full {
  width: 100%;
}

.ghost-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--sidebar-text);
}

.guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 10, 15, 0.78);
  backdrop-filter: blur(5px);
}

.guide-dialog {
  width: min(100%, 720px);
  max-height: min(82vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: 0 24px 70px var(--shadow);
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.guide-header h2 {
  margin: 5px 0 0;
  font-size: 1.35rem;
}

.guide-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 1.35rem;
  line-height: 1;
}

.guide-close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.guide-search-label {
  padding: 16px 22px 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.guide-search {
  margin: 0 22px 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--bg-soft);
  color: var(--text);
}

.guide-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.guide-list {
  overflow-y: auto;
  padding: 0 22px 18px;
}

.guide-entry {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.guide-entry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.guide-entry-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.guide-entry-heading span {
  color: var(--muted);
  font-size: 0.75rem;
}

.guide-entry > p,
.guide-empty {
  margin: 7px 0 10px;
  color: var(--sidebar-text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.guide-entry pre {
  overflow-x: auto;
  margin: 0 0 10px;
  padding: 12px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.035);
  color: #dce8e2;
  font: 0.82rem/1.55 "Consolas", "SFMono-Regular", monospace;
  white-space: pre;
}

.guide-insert {
  padding: 7px 10px;
  font-size: 0.78rem;
}

.guide-empty {
  padding: 18px 0;
}

.schema-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}

.schema-list,
.table-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.schema-item,
.table-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--sidebar-text);
  padding: 10px 12px;
  cursor: pointer;
  transition: 0.18s ease;
}

.schema-item .table-list {
  margin-top: 10px;
}

.schema-item.active,
.table-item.active {
  background: rgba(83, 74, 183, 0.16);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(83, 74, 183, 0.35);
}

.schema-item:hover,
.table-item:hover {
  border-color: var(--accent);
}

.table-list {
  margin-top: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.table-item {
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.9rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.resize-handle {
  position: relative;
  z-index: 2;
  background: transparent;
  transition: background 0.18s ease;
}

.resize-handle:hover,
body.is-resizing .resize-handle {
  background: var(--accent);
}

.sidebar-resize,
.details-resize {
  cursor: col-resize;
}

.result-resize {
  height: 8px;
  flex: 0 0 8px;
  cursor: row-resize;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
  padding: 10px 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.tab-scroll {
  width: 24px;
  height: 30px;
  flex: 0 0 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

.tab-scroll:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.tab-scroll:disabled {
  cursor: default;
  opacity: 0.3;
}

.tab-item {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 7px 9px;
  white-space: nowrap;
}

.tab-item.active {
  background: var(--bg);
  border-color: var(--accent);
}

.tab.active {
  color: var(--text);
  padding-left: 12px;
  padding-right: 12px;
}

.tab.standalone {
  border-radius: 8px;
}

.tab-close {
  width: 24px;
  height: 28px;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 0.85rem;
  line-height: 1;
}

.tab-close:hover {
  background: rgba(248, 113, 113, 0.08);
  color: var(--danger);
}

.tab-add {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
}

.tab-add:hover {
  border-color: var(--accent);
  color: var(--accent-soft);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px var(--details-width);
  min-height: 0;
  flex: 1;
}

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

.query-panel,
.details-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.query-panel {
  border-right: 1px solid var(--border);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sql-editor-wrap {
  position: relative;
  min-height: 120px;
  height: var(--editor-height);
  flex: 0 0 var(--editor-height);
  overflow: visible;
  background: rgba(11, 14, 20, 0.6);
}

#sqlHighlight,
#sqlEditor {
  position: absolute;
  inset: 0;
  width: 100%;
  resize: vertical;
  border: none;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 16px;
  margin: 0;
  white-space: pre-wrap;
  overflow: auto;
  overflow-wrap: break-word;
}

#sqlHighlight {
  color: var(--text);
  pointer-events: none;
}

#sqlEditor {
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  outline: none;
}

.sql-suggestions {
  position: absolute;
  top: 0;
  left: 16px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 32px);
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(18, 23, 33, 0.96);
  box-shadow: 0 12px 24px var(--shadow);
}

.sql-suggestion {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--muted);
  padding: 5px 8px;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.78rem;
}

.sql-suggestion:hover,
.sql-suggestion.active {
  border-color: var(--accent);
  background: rgba(83, 74, 183, 0.2);
  color: var(--text);
}

#sqlEditor::selection {
  background: rgba(132, 116, 255, 0.35);
}

.sql-keyword {
  color: #c4b5fd;
  font-weight: 600;
}

.sql-string {
  color: #f9c74f;
}

.sql-type {
  color: #7dd3fc;
}

.sql-number {
  color: #f0abfc;
}

.sql-comment {
  color: #7f8c98;
  font-style: italic;
}

.sql-identifier {
  color: #a7f3d0;
}

.sql-function {
  color: #93c5fd;
}

.sql-operator {
  color: #fda4af;
}

.query-panel.results-hidden #sqlEditor {
  height: auto;
  flex: 1;
}

.query-panel.results-hidden .sql-editor-wrap {
  height: auto;
  flex: 1;
}

.query-panel.results-hidden .result-resize,
.query-panel.results-hidden .results-header,
.query-panel.results-hidden .table-wrap,
.details-panel.hidden + .details-resize {
  display: none;
}

.results-header {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.table-wrap {
  overflow: auto;
  flex: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th, td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel-alt);
  color: var(--text);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  color: var(--sidebar-text);
  font-size: 0.9rem;
}

.status-heading {
  color: var(--danger);
  font-size: 0.8rem;
  text-align: left;
}

.status-cell {
  color: var(--text);
}

.error-cell {
  color: var(--danger);
  white-space: pre-wrap;
}

.details-panel {
  background: var(--panel-alt);
}

.details-content {
  padding: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.details-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.details-card h3 {
  margin: 0;
  color: var(--text);
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 16px;
  margin: 0;
  color: var(--sidebar-text);
}

.hidden {
  display: none !important;
}

.sidebar.collapsed {
  overflow: hidden;
  padding: 18px 8px;
  border-right: 0;
}

.sidebar.collapsed .brand-row {
  justify-content: center;
  padding: 6px 0 12px;
}

.sidebar.collapsed .brand-row > div,
.sidebar.collapsed .connection-box,
.sidebar.collapsed .schema-box {
  display: none;
}

.app-shell:has(.sidebar.collapsed) {
  grid-template-columns: 64px 8px minmax(0, 1fr);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-resize,
  .details-resize {
    display: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .query-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  body {
    padding: 8px;
  }

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

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions .ghost-btn {
    flex: 1 1 auto;
    padding: 8px 9px;
    font-size: 0.78rem;
  }

  .guide-backdrop {
    padding: 10px;
  }

  .guide-dialog {
    max-height: 90vh;
  }

  .guide-header,
  .guide-list {
    padding-left: 16px;
    padding-right: 16px;
  }

  .guide-search-label {
    padding-left: 16px;
  }

  .guide-search {
    margin-right: 16px;
    margin-left: 16px;
  }
}

/* Pixel-accurate Figma export */
body:has(.figma-stage) {
  padding: 0;
  background: #0d1015;
}

.auth-screen {
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0d1015;
}

.auth-screen::before {
  display: none;
}

.figma-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.figma-stage > img {
  display: block;
  width: 100%;
  height: auto;
}

.figma-hit {
  position: absolute;
  z-index: 3;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
  cursor: pointer;
}

.figma-cta { top: 33.16%; left: 9.72%; width: 11.04%; height: 2.64%; }
.figma-explore { top: 33.19%; left: 21.60%; width: 10.49%; height: 2.58%; }
.figma-login { top: 1.54%; left: 80%; width: 10.28%; height: 2.20%; }
.auth-screen > .landing-nav,
.auth-screen > .landing-layout,
.auth-screen > .landing-features { display: none; }
.auth-screen.auth-mode { display: grid; min-height: 100vh; place-items: center; padding: 30px 20px; }
.auth-screen.auth-mode .figma-stage { display: none; }

/* Live SQL preview: keeps the Figma composition while making its UI text real. */
.live-product-preview {
  position: absolute;
  top: 12.80%;
  left: 51.04%;
  z-index: 2;
  width: 39.24%;
  height: 22.20%;
  overflow: visible;
  border-radius: 16px;
  background: #10151f;
  box-shadow: 0 24px 42px rgba(0, 0, 0, 0.25);
  color: #c9d2e7;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: clamp(7px, 0.9vw, 14px);
}

.live-product-preview::after {
  position: absolute;
  inset: 0;
  z-index: 5;
  border: 1px solid #34405a;
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.live-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 9.65%;
  padding: 0 3.2%;
  border-bottom: 1px solid #202a3e;
  border-radius: 16px 16px 0 0;
  background: #1a2130;
}

.live-window-dots { display: flex; gap: 8px; }
.live-window-dots i { width: 7px; height: 7px; border-radius: 50%; background: #424b63; }
.live-preview-title { color: #8490a8; font-size: 0.72em; letter-spacing: 0.03em; }
.live-preview-main { display: grid; grid-template-columns: 24.6% 75.4%; height: 90.35%; }

.live-preview-schema {
  min-width: 0;
  padding: 7.3% 9.4%;
  border-right: 1px solid #202a3e;
  border-bottom-left-radius: 16px;
  background: #121824;
}

.live-preview-schema > p {
  margin: 0 0 10%;
  color: #8d99ad;
  font-size: 0.72em;
  letter-spacing: 0.13em;
}

.live-database {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 11% 10%;
  border: 1px solid #8793a2;
  border-radius: 10px;
  background: #2a313b;
}

.live-database strong { color: #e7edf8; font-size: 0.88em; }
.live-database button,
.live-query-tab,
.live-run-query {
  border: 0;
  color: #c9d2e7;
  font-family: inherit;
  cursor: pointer;
}

.live-database button {
  width: 100%;
  padding: 12% 9%;
  border-radius: 7px;
  background: #20273a;
  text-align: left;
  font-size: 0.82em;
}

.live-query-area { min-width: 0; overflow: hidden; border-bottom-right-radius: 16px; background: #0d1119; }
.live-query-toolbar { display: flex; align-items: center; justify-content: space-between; height: 13.5%; padding: 0 5.2%; }
.live-query-tab { padding: 4% 6%; border: 1px solid #8793a2; border-radius: 7px; background: #2a313b; font-size: 0.82em; }
.live-query-tab span { margin-left: 0.3em; font-size: 1.1em; }
.live-run-query { padding: 3.5% 5%; border-radius: 7px; background: #5d6674; color: #fff; font-family: "Segoe UI", sans-serif; font-size: 0.8em; font-weight: 700; }
.live-sql { height: 55%; margin: 0; padding: 7.5% 5.2%; color: #c9d2e7; font: 0.9em/2.05 Consolas, "SFMono-Regular", monospace; white-space: pre-wrap; }
.live-sql span { color: #d4ddef; }.live-sql b { color: #e7d8a9; font-weight: 400; }
.live-result { height: 31.5%; padding: 5% 5.2%; border-bottom-right-radius: 16px; background: #161d29; }
.live-result-heading { display: flex; justify-content: space-between; color: #8d99ad; font-size: 0.72em; letter-spacing: 0.13em; }
.live-result-heading span:last-child { letter-spacing: 0; }
.live-result-id { display: block; margin-top: 9%; color: #d4ddef; font-size: 0.82em; }
.live-query-toast { position: absolute; right: -5.2%; bottom: -8.5%; z-index: 10; display: flex; align-items: center; gap: 12px; width: 36.6%; min-width: 170px; padding: 3.4% 4.2%; border: 1px solid #303945; border-radius: 10px; background: #181d2a; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2); color: #c9d2e7; font-family: "Segoe UI", sans-serif; font-size: 0.82em; white-space: nowrap; }
.live-query-toast > span { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%; background: #81e5c0; }
.live-query-toast b { font-size: 1.1em; font-weight: 400; }

/* Landing page */
.auth-screen {
  position: relative;
  min-height: calc(100vh - 36px);
  overflow: hidden;
  padding: 0 clamp(20px, 5vw, 76px);
  background: #f5f7fb;
  color: #16152a;
}

.auth-screen::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: linear-gradient(rgba(83, 74, 183, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(83, 74, 183, 0.06) 1px, transparent 1px);
  background-size: 52px 52px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 88%);
  pointer-events: none;
}

.landing-nav,
.landing-layout,
.landing-features,
.auth-screen > .auth-card {
  position: relative;
  z-index: 1;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1420px;
  margin: 0 auto;
  padding: 26px 0;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1b1932;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.landing-brand .brand-mark { width: 30px; height: 30px; flex-basis: 30px; }

.landing-nav-links { display: flex; align-items: center; gap: clamp(18px, 3vw, 44px); }
.landing-nav-links a { color: #6e6b83; font-size: 0.78rem; text-decoration: none; }
.landing-nav-links a:hover, .text-link:hover { color: var(--accent); }

.nav-login-btn,
.back-link {
  border: 0;
  background: transparent;
  color: #211d49;
  font-weight: 600;
}

.nav-login-btn { padding: 10px 0; font-size: 0.78rem; }
.nav-login-btn span { margin-left: 7px; color: var(--accent); font-size: 1rem; }

.landing-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.82fr) minmax(480px, 1.18fr);
  align-items: center;
  gap: clamp(30px, 6vw, 120px);
  max-width: 1420px;
  min-height: calc(100vh - 170px);
  margin: 0 auto;
  padding: 22px 0 70px;
}

.landing-copy { max-width: 570px; animation: landing-in 0.75s ease both; }
.landing-kicker { display: flex; align-items: center; gap: 9px; margin: 0 0 24px; color: var(--accent); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #36b37e; box-shadow: 0 0 0 5px rgba(54, 179, 126, 0.12); }
.landing-copy h1 { max-width: 600px; margin: 0; color: #1c1935; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.3rem, 6.2vw, 6.2rem); font-weight: 400; letter-spacing: -0.06em; line-height: 0.98; white-space: normal; }
.landing-copy h1 em { color: var(--accent); font-style: italic; }
.landing-description { max-width: 440px; margin: 30px 0 0; color: #747188; font-size: 1rem; line-height: 1.7; }
.landing-actions { display: flex; align-items: center; gap: 27px; margin-top: 34px; }
.landing-cta { display: inline-flex; align-items: center; gap: 26px; padding: 15px 18px 15px 20px; border-radius: 8px; box-shadow: 0 12px 22px rgba(83, 74, 183, 0.2); }
.landing-cta span { font-size: 1.1rem; }
.text-link { color: #4d4963; font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.text-link span { margin-left: 6px; color: var(--accent); font-size: 1rem; }
.landing-proof { display: flex; align-items: center; gap: 14px; margin-top: 64px; color: #9a97aa; font-size: 0.72rem; line-height: 1.5; }
.landing-proof p { margin: 0; }
.landing-proof strong { color: #4e4a66; font-weight: 600; }
.proof-avatars { display: flex; padding-left: 9px; }
.proof-avatars span { display: grid; place-items: center; width: 28px; height: 28px; margin-left: -9px; border: 2px solid #f5f7fb; border-radius: 50%; background: #dddaf9; color: #534ab7; font-size: 0.55rem; font-weight: 700; }
.proof-avatars span:nth-child(2) { background: #f2d8c8; color: #8b4d3b; }
.proof-avatars span:nth-child(3) { background: #211d49; color: white; }

.product-preview { position: relative; min-height: 510px; animation: landing-in 0.8s 0.12s ease both; }
.preview-glow { position: absolute; top: 20%; right: 4%; width: 70%; height: 60%; border-radius: 50%; background: rgba(125, 115, 234, 0.22); filter: blur(65px); }
.preview-window { position: absolute; top: 42px; right: 4%; width: min(100%, 675px); overflow: hidden; border: 1px solid rgba(112, 105, 175, 0.35); border-radius: 11px; background: #1b1931; box-shadow: 0 35px 80px rgba(41, 35, 94, 0.26); transform: rotate(2.2deg); }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; height: 43px; padding: 0 15px; border-bottom: 1px solid #302b53; color: #847fa6; font-size: 0.62rem; }
.window-dots { display: flex; gap: 5px; }.window-dots i { width: 6px; height: 6px; border-radius: 50%; background: #5b5577; }.window-dots i:first-child { background: #e28688; }.window-dots i:nth-child(2) { background: #dbb26e; }.window-dots i:nth-child(3) { background: #6bbd91; }
.preview-lock { color: #8781d6; font-size: 1rem; }.preview-body { display: grid; grid-template-columns: 122px 1fr; min-height: 390px; }.preview-sidebar { padding: 18px 14px; border-right: 1px solid #302b53; }.preview-logo img { width: 21px; height: 21px; margin-bottom: 30px; }.preview-line { display: block; width: 76%; height: 5px; margin: 12px 0; border-radius: 8px; background: #403b60; }.preview-line.wide { width: 90%; }.preview-line.short { width: 54%; }.preview-line.active { width: 85%; background: #6a61cc; box-shadow: 0 0 14px rgba(106, 97, 204, 0.7); }.preview-sidebar-gap { height: 27px; }
.preview-editor { padding: 37px 32px; color: #d7d2ed; font: 0.8rem/2.1 Consolas, monospace; }.code-line b { color: #9c91f4; font-weight: 400; }.code-line i { color: #8fd8c4; font-style: normal; }.code-line mark { color: #f2c77d; background: none; }.editor-space { height: 112px; }.result-label { display: flex; justify-content: space-between; padding-bottom: 9px; border-bottom: 1px solid #3a345d; color: #8781a9; font: 0.58rem/1.2 "Segoe UI", sans-serif; letter-spacing: 0.12em; }.result-label span { color: #63c19a; letter-spacing: 0; }.preview-table { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 8px; padding-top: 15px; }.preview-table span { height: 7px; border-radius: 4px; background: #403b60; }.preview-table span:nth-child(3n + 1) { background: #625bb1; }
.preview-badge { position: absolute; display: flex; flex-direction: column; gap: 3px; min-width: 145px; padding: 13px 16px; border: 1px solid rgba(116, 108, 187, 0.22); border-radius: 8px; background: rgba(255, 255, 255, 0.84); box-shadow: 0 17px 35px rgba(68, 59, 133, 0.14); backdrop-filter: blur(12px); }.preview-badge span { position: absolute; top: 14px; right: 14px; color: #6b61d2; }.preview-badge strong { color: #292442; font-size: 0.66rem; }.preview-badge small { color: #9995aa; font-size: 0.6rem; }.badge-schema { top: 25px; left: 1%; }.badge-query { right: 0; bottom: 42px; }.badge-query span { color: #42ad81; }
.landing-features { display: flex; justify-content: space-between; max-width: 1420px; margin: 0 auto; padding: 0 0 24px; color: #aaa7b7; font-size: 0.58rem; letter-spacing: 0.1em; }
.auth-screen.auth-mode { display: grid; place-items: center; padding: 30px 20px; }.auth-screen.auth-mode::before, .auth-screen.auth-mode .landing-nav, .auth-screen.auth-mode .landing-layout, .auth-screen.auth-mode .landing-features { display: none; }.auth-screen.auth-mode .auth-card { display: block !important; }
.auth-screen.auth-mode .auth-card h2 { margin: 6px 0 24px; color: var(--text); font-size: 1.8rem; }.back-link { display: block; margin: -10px 0 24px; padding: 0; color: var(--muted); font-size: 0.74rem; }.back-link:hover { color: var(--accent); }

@keyframes landing-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
  .landing-layout { grid-template-columns: 1fr; min-height: 0; padding-top: 60px; }.landing-copy { max-width: 620px; }.landing-copy h1 { font-size: clamp(3.5rem, 10vw, 5.5rem); }.product-preview { min-height: 470px; width: min(100%, 720px); margin: 0 auto; }.landing-proof { margin-top: 42px; }.landing-features { padding-top: 15px; }
}

@media (max-width: 640px) {
  .auth-screen { min-height: calc(100vh - 16px); padding: 0 18px; }.landing-nav { padding: 19px 0; }.landing-nav-links a { display: none; }.landing-layout { gap: 12px; padding-top: 47px; }.landing-copy h1 { font-size: clamp(3.15rem, 16vw, 4.5rem); }.landing-description { margin-top: 22px; font-size: 0.9rem; }.landing-actions { align-items: flex-start; flex-direction: column; gap: 18px; margin-top: 27px; }.landing-proof { margin-top: 36px; }.product-preview { min-height: 330px; margin-top: 22px; transform: scale(0.88); transform-origin: top left; width: 114%; }.preview-window { top: 30px; right: 0; }.preview-badge { display: none; }.landing-features { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 0 0 18px; }.auth-screen.auth-mode { padding: 18px; }.auth-screen.auth-mode .auth-card { padding: 26px 22px; }
}

/* The Figma frame is the source of truth for the unauthenticated page. */
body:has(.figma-stage) { padding: 0; background: #0d1015; }
.auth-screen { min-height: 100vh; padding: 0; overflow-x: hidden; overflow-y: auto; background: #0d1015; }
.auth-screen::before { display: none; }
.figma-stage { position: relative; z-index: 2; width: 100%; max-width: 1440px; margin: 0 auto; }
.figma-stage > img { display: block; width: 100%; height: auto; }
.figma-hit { position: absolute; z-index: 3; display: block; padding: 0; border: 0; background: transparent; color: transparent; font-size: 0; cursor: pointer; }
.figma-cta { top: 33.16%; left: 9.72%; width: 11.04%; height: 2.64%; }
.figma-explore { top: 33.19%; left: 21.60%; width: 10.49%; height: 2.58%; }
.figma-login { top: 1.54%; left: 80%; width: 10.28%; height: 2.20%; }
.figma-final-explore { top: 86.48%; left: 44.31%; width: 11.39%; height: 2.64%; }
.auth-screen > .landing-nav, .auth-screen > .landing-layout, .auth-screen > .landing-features { display: none; }
.auth-screen.auth-mode { display: grid; min-height: 100vh; place-items: center; padding: 30px 20px; }
.auth-screen.auth-mode .figma-stage { display: none; }
