/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --border:   #cfd8e3;
  --text:     #1a202c;
  --muted:    #5a6a7a;
  --accent:   #2b6cb0;
  --accent2:  #2c7a7b;
  --nav-bg:   #1a2a3a;
  --nav-text: #e2eaf2;
  --font:     system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:     'Fira Mono', 'Courier New', monospace;
  --radius:   8px;
}

/* ── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg);
       color: var(--text); line-height: 1.65; }
h1, h2, h3, h4 { margin-top: 0; line-height: 1.2; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: 0.9em;
       background: #e8f0fa; padding: 0.1em 0.35em; border-radius: 3px; }
pre {
  font-family: var(--mono); font-size: 0.875rem; line-height: 1.6;
  background: #0f1923; color: #b0cce4;
  padding: 1.1rem 1.3rem; border-radius: var(--radius);
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: inherit; }
ul { padding-left: 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.8rem; border: 1px solid var(--border); }
thead th { background: #dde8f4; font-weight: 600; position: sticky; top: 0; }
tbody tr:nth-child(even) { background: #f5f8fc; }
tbody tr:hover { background: #dbeafe; }

/* ── Nav ──────────────────────────────────────────────────────────────────── */
nav {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--nav-bg); color: var(--nav-text);
  padding: 0.75rem 2rem; flex-wrap: wrap;
}
nav .brand { font-weight: 700; font-size: 1.1rem; margin-right: auto;
             letter-spacing: 0.02em; }
nav a { color: var(--nav-text); text-decoration: none;
        font-size: 0.95rem; opacity: 0.75; transition: opacity .15s; }
nav a:hover, nav a.active { opacity: 1; text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
main { max-width: 980px; margin: 2rem auto; padding: 0 1.25rem; }
footer { text-align: center; padding: 2rem; font-size: 0.85rem;
         color: var(--muted); border-top: 1px solid var(--border);
         margin-top: 3rem; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero { padding: 2.25rem 0 1.25rem; }
.hero h1 { font-size: 2.6rem; margin-bottom: 0.4rem; color: #1a3a5c; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 700px; }
.badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.badge { background: var(--accent); color: #fff;
         border-radius: 99px; padding: 0.2rem 0.8rem;
         font-size: 0.78rem; font-weight: 600; }
.badge.teal { background: var(--accent2); }

/* ── Comparison table ─────────────────────────────────────────────────────── */
.cmp { border-collapse: collapse; width: 100%; margin: 0.5rem 0; }
.cmp th { background: #1a3a5c; color: #fff; }
.cmp td:first-child { font-weight: 500; color: var(--muted); }
.cmp .yes { color: #276749; font-weight: 600; }
.cmp .no  { color: #9b2c2c; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
        box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border);
           padding-bottom: 0.4rem; margin-bottom: 1rem; }
.card h3 { font-size: 1.05rem; color: #1a3a5c; margin-bottom: 0.5rem; }

/* ── Status ───────────────────────────────────────────────────────────────── */
.status { padding: 0.65rem 1rem; border-radius: var(--radius);
          margin-bottom: 1rem; font-weight: 500; }
.status.loading { background: #ebf4ff; color: #1a4a7a; border: 1px solid #bee3f8; }
.status.ok      { background: #e6fffa; color: #1d4a3a; border: 1px solid #81e6d9; }
.status.error   { background: #fff5f5; color: #742a2a; border: 1px solid #feb2b2; }
.progress { height: 4px; background: #bee3f8; border-radius: 2px; margin-top: 6px; }
.progress-bar { height: 4px; background: var(--accent);
                border-radius: 2px; transition: width .2s; }

/* ── Controls ─────────────────────────────────────────────────────────────── */
.controls { display: flex; flex-wrap: wrap; align-items: center;
            gap: 1rem; margin-bottom: 1rem; }
.controls label { display: flex; align-items: center; gap: 0.4rem; }
select, button { padding: 0.35rem 0.65rem; border: 1px solid var(--border);
                 border-radius: 5px; font-size: 0.95rem;
                 background: var(--surface); cursor: pointer; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { filter: brightness(1.1); }

/* ── Schema grid ──────────────────────────────────────────────────────────── */
.schema-grid { display: grid;
               grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
               gap: 0.75rem; margin-top: 0.5rem; }
.schema-card { background: var(--bg); border: 1px solid var(--border);
               border-radius: var(--radius); padding: 0.75rem; }
.schema-card h4 { margin: 0 0 0.4rem; color: var(--accent); font-size: 0.95rem; }
.schema-card ul { margin: 0; padding-left: 1.1rem; font-size: 0.83rem; color: var(--muted); }
.schema-card li { margin-bottom: 2px; }
.schema-card .type { color: var(--accent2); font-family: var(--mono); font-size: 0.78rem; }

/* ── SQL textarea ─────────────────────────────────────────────────────────── */
textarea {
  width: 100%; box-sizing: border-box; font-family: var(--mono);
  font-size: 0.9rem; line-height: 1.55; padding: 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  resize: vertical; background: #0f1923; color: #b0cce4;
}
#error-box  { color: #c53030; font-family: var(--mono);
              white-space: pre-wrap; font-size: 0.85rem; }
#row-count  { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.overflow   { overflow-x: auto; }
