:root {
  --bg: #0b0f17;
  --bg2: #101624;
  --panel: #121a29;
  --border: #1f2a3d;
  --border-strong: #2a3a55;
  --text: #e7edf6;
  --text-dim: #8b98ad;
  --accent: #4b6bd8;
  --accent-2: #7c5cff;
  --accent-soft: rgba(75, 107, 216, 0.16);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); }

/* ---- nav ---------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 26px;
  background: rgba(11, 15, 23, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; }
.logo { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.logo .accent { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.nav-links a { color: var(--text-dim); transition: color .12s; }
.nav-links a:hover { color: var(--text); }

/* ---- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 13px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3f5cc7; border-color: #3f5cc7; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; font-weight: 600; }

/* ---- hero --------------------------------------------------------------- */
.hero {
  position: relative;
  padding: 96px 26px 72px;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(55% 70% at 18% 0%, rgba(75, 107, 216, 0.20), transparent 60%),
    radial-gradient(50% 65% at 82% 8%, rgba(124, 92, 255, 0.16), transparent 55%),
    var(--bg);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(60% 60% at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 860px; margin: 0 auto; }
.eyebrow {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--panel);
}
.hero h1 {
  font-size: clamp(36px, 6vw, 60px);
  line-height: 1.08;
  letter-spacing: -1.5px;
  margin: 22px 0 18px;
  font-weight: 800;
}
.grad {
  background: linear-gradient(92deg, #7b96ff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 28px;
}
.lead code {
  color: var(--text);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 15px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex;
  gap: 48px;
  justify-content: center;
  margin-top: 44px;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 26px; font-weight: 800; }
.stat span { font-size: 13px; color: var(--text-dim); }

/* ---- features ----------------------------------------------------------- */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 56px 26px;
  max-width: 1200px;
  margin: 0 auto;
}
.feature {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 22px;
  transition: border-color .15s, transform .15s;
}
.feature:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.f-icon { font-size: 24px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--text-dim); font-size: 13.5px; }

/* ---- tool section ------------------------------------------------------- */
.tool-section {
  height: 88vh;
  min-height: 680px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.tool-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 26px 14px;
  flex-shrink: 0;
}
.tool-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.3px; }
.hint { color: var(--text-dim); font-size: 12.5px; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 40% 60%;
  min-height: 0;
  margin: 0 26px 26px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.editor-pane { border-right: 1px solid var(--border); background: var(--bg2); }
.diagram-pane { background: var(--bg); }

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pane-head label { font-weight: 600; font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.sample-row { display: flex; align-items: center; gap: 6px; }

select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: var(--sans);
  font-size: 13px;
}

textarea {
  flex: 1;
  min-height: 0;
  background: var(--bg);
  color: var(--text);
  border: none;
  outline: none;
  resize: none;
  padding: 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}
textarea::placeholder { color: #4a5568; }

.meta {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 34px;
  flex-shrink: 0;
}
#errors { color: #f1a8a8; }
#errors .err { margin-top: 2px; }

/* diagram */
.diagram-toolbar { justify-content: space-between; }
.tb-group { display: flex; align-items: center; gap: 5px; }
.export-group .btn { font-family: var(--mono); font-size: 12px; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 5px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  z-index: 40;
}
.dropdown-menu[hidden] { display: none; }
.dd-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.dd-item:hover { background: var(--accent-soft); }

.canvas-wrap { flex: 1; position: relative; min-height: 0; overflow: hidden; }
#diagram { width: 100%; height: 100%; display: block; cursor: grab; background: var(--bg); }
#diagram:active { cursor: grabbing; }
#diagram g.sqlviz-table { cursor: move; }

.empty-hint {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-align: center;
  pointer-events: none;
  gap: 8px;
}
.empty-icon { font-size: 42px; opacity: .5; }
.empty-hint code { color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; }

/* detail drawer */
.detail {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 300px;
  max-width: 80%;
  max-height: calc(100% - 28px);
  overflow: auto;
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  transform: translateX(120%);
  transition: transform .18s ease;
  z-index: 5;
}
.detail.open { transform: translateX(0); }
.detail-close { position: absolute; top: 8px; right: 10px; background: transparent; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; line-height: 1; }
.detail h3 { margin: 0 0 10px; font-family: var(--mono); font-size: 15px; }
.d-row { padding: 5px 0; border-bottom: 1px solid var(--border); }
.d-row:last-child { border-bottom: none; }
.d-name { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.d-type { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.d-flags { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }
.d-flags span { font-size: 10px; font-family: var(--mono); color: var(--text-dim); background: var(--panel); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 5px; }

/* ---- cross-sell band ---------------------------------------------------- */
.cross-band { border-top: 1px solid var(--border); background: var(--bg2); padding: 30px 26px; }
.cross-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.cross-inner h3 { margin: 0 0 5px; font-size: 17px; }
.cross-inner p { margin: 0; color: var(--text-dim); font-size: 13.5px; max-width: 660px; }

/* ---- payment trust badges ------------------------------------------------- */
.foot-left { display: flex; flex-direction: column; gap: 2px; }
.pay-badges { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.pay-badges-label { font-size: 12px; color: var(--text-dim); margin-right: 2px; }
.pay-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #1a1a1a; border-radius: 6px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 700;
  font-family: var(--sans); letter-spacing: .01em; line-height: 1.5;
}
.pay-badge.paypal { color: #003087; }
.pay-badge.visa { color: #1a1f71; font-style: italic; letter-spacing: .04em; }
.mc-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; }
.mc-dot.mc-r { background: #eb001b; }
.mc-dot.mc-o { background: #f79e1b; margin-left: -5px; }

/* ---- footer ------------------------------------------------------------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 26px;
  color: var(--text-dim);
  font-size: 12.5px;
}
.support-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.support-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

/* modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 24px;
  width: 360px;
  max-width: 92%;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal-text { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin: 0 0 16px; }
.modal-close { position: absolute; top: 10px; right: 12px; background: transparent; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; line-height: 1; }
.amount-row { display: flex; gap: 8px; margin-bottom: 14px; }
.amount {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.amount:hover { border-color: var(--accent); }
.amount.active { background: var(--accent-soft); border-color: var(--accent); color: #fff; }
.btn-block { display: block; width: 100%; padding: 10px; font-size: 14px; }
.modal-note { color: var(--text-dim); font-size: 11px; text-align: center; margin: 12px 0 0; }

/* toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 200;
}
.toast[hidden] { display: none; }

/* ---- auth / pro ---------------------------------------------------------- */
.auth-area { display: flex; align-items: center; gap: 8px; margin-left: 4px; }
.plan-badge { font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; }
.plan-badge.pro { background: rgba(232,181,74,.18); color: #e8b54a; border: 1px solid rgba(232,181,74,.4); }
.plan-badge.free { background: var(--panel); color: var(--text-dim); border: 1px solid var(--border-strong); }
.field-label { display: block; font-size: 12px; color: var(--text-dim); margin: 12px 0 5px; }
.field { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: 7px; padding: 9px 11px; font-size: 14px; font-family: var(--sans); }
.field:focus { outline: none; border-color: var(--accent); }
.form-error { color: #f1a8a8; font-size: 12.5px; min-height: 18px; margin-top: 8px; }
.link-btn { display: block; width: 100%; margin-top: 14px; background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; text-align: center; }
.link-btn:hover { text-decoration: underline; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin: 12px 0; cursor: pointer; }
.schemas-list { max-height: 320px; overflow: auto; margin: 4px 0 12px; }
.schema-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.schema-row:last-child { border-bottom: none; }
.schema-title { font-weight: 600; font-size: 14px; }
.schema-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.schema-actions { display: flex; gap: 6px; }
.pub-tag { font-size: 10px; color: #4cc38a; border: 1px solid rgba(76,195,138,.4); padding: 1px 6px; border-radius: 999px; }
.pub-tag.priv { color: var(--text-dim); border-color: var(--border-strong); }
.muted { color: var(--text-dim); padding: 14px 0; }
.pro-list { margin: 0 0 14px; padding-left: 18px; color: var(--text); font-size: 13.5px; line-height: 1.9; }
.paypal-btn { margin-top: 8px; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 960px) {
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .nav-links a:not(.btn) { display: none; }
  .hero { padding: 64px 20px 48px; }
  .hero-stats { gap: 28px; }
  .features { grid-template-columns: 1fr; padding: 40px 20px; }
  .tool-section { height: auto; min-height: 0; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 340px 480px; margin: 0 20px 20px; }
  .editor-pane { border-right: none; border-bottom: 1px solid var(--border); }
  .hint { display: none; }
}
