:root {
  --bg: #08090b;
  --bg-2: #0d0e12;
  --bg-3: #11131a;
  --line: #1d1f29;
  --line-2: #2a2d3a;
  --ink: #e9ecf3;
  --ink-2: #aab0bf;
  --ink-3: #6e7385;
  --ink-4: #4a4e5c;
  --green: #4ade80;
  --amber: #fbbf24;
  --rose: #fb7185;
  --blue: #60a5fa;
  --purple: #a78bfa;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.mono { font-family: 'JetBrains Mono', monospace; }
a { color: inherit; text-decoration: none; }

/* Background effects */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(96, 165, 250, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(167, 139, 250, 0.06), transparent 60%);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at center, black, transparent);
  mask-image: radial-gradient(ellipse 60% 60% at center, black, transparent);
}

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
  background: rgba(8, 9, 11, 0.7);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1280px; margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 32px);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; letter-spacing: -0.01em; font-size: 0.95rem;
  cursor: pointer; -webkit-user-select: none; user-select: none;
}
.logo__mark {
  width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  position: relative; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
  flex-shrink: 0;
}
.logo__mark::after {
  content: ''; position: absolute; inset: 6px;
  background: var(--bg); border-radius: 3px;
}
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  padding: 6px 12px; border-radius: 6px;
  color: var(--ink-2); text-decoration: none;
  font-size: 0.86rem; font-weight: 500;
  transition: background .15s, color .15s; cursor: pointer;
}
.nav a:hover { background: var(--bg-3); color: var(--ink); }
.nav a.active { color: var(--ink); background: var(--bg-3); }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.btn-sm {
  padding: 6px 12px; border-radius: 6px;
  font-size: 0.83rem; font-weight: 500;
  text-decoration: none; transition: all .15s;
  border: 1px solid var(--line-2);
  color: var(--ink-2); background: transparent; cursor: pointer;
}
.btn-sm:hover { background: var(--bg-3); color: var(--ink); border-color: var(--ink-4); }
.btn-sm.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-sm.solid:hover { background: white; }
@media (max-width: 720px) { .nav a:not(.always) { display: none; } }

/* ── Main wrap (landing) ── */
.wrap {
  position: relative; z-index: 1;
  max-width: 1280px; margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* ── Hero ── */
.hero {
  padding: 96px 0 80px; text-align: center;
  max-width: 880px; margin: 0 auto;
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
  font-size: 0.78rem; color: var(--ink-2); margin-bottom: 28px;
}
.badge__pill {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: white; padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em;
}
.badge__sep { color: var(--ink-4); }
.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 4.2rem); line-height: 1.02;
  margin: 0 0 20px; letter-spacing: -0.035em; font-weight: 600;
  background: linear-gradient(180deg, #ffffff 0%, #aaadc0 110%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  color: var(--ink-2); font-size: clamp(1rem, 1.4vw, 1.12rem);
  max-width: 620px; margin: 0 auto 36px;
}
.hero-cta { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-weight: 500; font-size: 0.9rem;
  text-decoration: none; transition: all .15s; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--bg); border: none; }
.btn-primary:hover { background: white; transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(255,255,255,0.2); }
.btn-secondary { background: var(--bg-2); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover { background: var(--bg-3); border-color: var(--ink-4); }
.btn .mono-key {
  background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--ink-2);
}
.btn-primary .mono-key { background: rgba(0,0,0,0.12); color: var(--ink-3); }

/* ── Terminal widget ── */
.terminal {
  margin: 64px auto 0; max-width: 760px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.02);
  text-align: left;
}
.terminal__bar {
  padding: 10px 14px; background: var(--bg-3);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.term-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line-2); }
.terminal__title {
  flex: 1; text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem; color: var(--ink-3);
}
.terminal__body {
  padding: 18px 20px; font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem; line-height: 1.75; color: var(--ink-2);
}
.term-line { display: block; }
.term-prompt { color: var(--purple); }
.term-cmd { color: var(--ink); }
.term-ok { color: var(--green); }
.term-warn { color: var(--amber); }
.term-info { color: var(--blue); }
.term-mute { color: var(--ink-3); }
.term-cursor {
  display: inline-block; width: 8px; height: 14px;
  background: var(--ink-2); margin-left: 4px; vertical-align: -2px;
  animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Landing sections ── */
.wrap > section { padding: 60px 0; }
.section__head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 36px;
}
.section__tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem; color: var(--ink-3);
  white-space: nowrap;
}
.section__title {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 600; margin: 0; letter-spacing: -0.02em;
}

/* ── Tool cards (landing) ── */
.tools { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.tool {
  position: relative; padding: 28px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: inherit;
  transition: all .2s; display: flex; flex-direction: column;
  overflow: hidden; cursor: pointer;
}
.tool::before {
  content: ''; position: absolute; inset: 0; border-radius: 14px;
  padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, transparent 60%, rgba(96,165,250,0.4));
  -webkit-mask: linear-gradient(#000,#000) content-box, linear-gradient(#000,#000);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000,#000) content-box, linear-gradient(#000,#000);
  mask-composite: exclude;
  opacity: 0; transition: opacity .25s;
}
.tool:hover { transform: translateY(-3px); border-color: var(--line-2); }
.tool:hover::before { opacity: 1; }
.tool__top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.tool__num {
  font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; color: var(--ink-3);
  background: var(--bg-3); border: 1px solid var(--line); padding: 3px 8px; border-radius: 5px;
}
.tool__inputs {
  font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 6px;
}
.pip { width: 6px; height: 6px; background: var(--green); border-radius: 50%; box-shadow: 0 0 8px rgba(74,222,128,0.6); }
.tool h3 { font-size: 1.35rem; margin: 0 0 12px; letter-spacing: -0.02em; font-weight: 600; }
.tool > p { color: var(--ink-2); margin: 0 0 24px; font-size: 0.92rem; }
.tool__schema {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 16px; margin: 0 0 22px;
  color: var(--ink-2); line-height: 1.75; flex: 1;
  white-space: pre; overflow-x: auto;
}
.tool__schema .key { color: var(--blue); }
.tool__schema .arr { color: var(--ink-4); }
.tool__schema .file { color: var(--purple); }
.tool__cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg-3);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.85rem; font-weight: 500;
  transition: all .15s; align-self: flex-start;
}
.tool:hover .tool__cta { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── Pipeline ── */
.pipeline { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); margin: 8px 0 0; }
@media (max-width: 920px) { .pipeline { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .pipeline { grid-template-columns: 1fr; } }
.step {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 22px;
}
.step__num { font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; color: var(--ink-3); margin-bottom: 12px; }
.step h4 { margin: 0 0 8px; font-size: 0.98rem; font-weight: 600; }
.step p { margin: 0; font-size: 0.86rem; color: var(--ink-2); }

/* ── Quality strip ── */
.quality {
  display: grid; gap: 0; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: var(--bg-2);
}
@media (max-width: 720px) { .quality { grid-template-columns: repeat(2, 1fr); } }
.quality__cell { padding: 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.quality__cell:last-child { border-right: 0; }
@media (max-width: 720px) {
  .quality__cell:nth-child(2) { border-right: 0; }
  .quality__cell:nth-child(3), .quality__cell:nth-child(4) { border-bottom: 0; }
}
.quality__num {
  font-family: 'JetBrains Mono', monospace; font-size: 2rem; font-weight: 600;
  background: linear-gradient(180deg, #fff, #888a96);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 8px; line-height: 1;
}
.quality__lbl { font-size: 0.84rem; color: var(--ink-2); }
.quality__det { font-size: 0.78rem; color: var(--ink-3); margin-top: 4px; }

/* ── Footer (landing) ── */
.wrap > footer {
  padding: 40px 0; margin-top: 20px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--ink-3);
}
.mono-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.mono-tag {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 5px;
  font-size: 0.74rem; color: var(--ink-2);
}

/* ═══════════════════════════════
   TOOL PAGE STYLES
   ═══════════════════════════════ */

/* ── Tool wrap ── */
.tool-wrap {
  position: relative; z-index: 1;
  max-width: 960px; margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px) 80px;
}

/* ── Page header ── */
.page-header { padding: 48px 0 36px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.page-header__back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.8rem;
  color: var(--ink-3); margin-bottom: 18px; cursor: pointer;
  transition: color .15s; background: none; border: none; padding: 0;
}
.page-header__back:hover { color: var(--ink-2); }
.page-header h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 600;
  letter-spacing: -0.025em; margin: 0 0 10px;
  background: linear-gradient(180deg, #fff, #aaadc0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-header p { color: var(--ink-2); font-size: 0.95rem; margin: 0; }

/* ── Panel ── */
.panel {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 26px; margin-bottom: 16px;
}
.panel__num {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  color: var(--ink-3); margin-bottom: 10px;
}
.panel__head { margin-bottom: 20px; }
.panel__head h2 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
.panel__head p { margin: 0; font-size: 0.84rem; color: var(--ink-3); }

/* ── Upload grid ── */
.upload-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ── Upload card ── */
.upload-card {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.upload-card__header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upload-card__label { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.upload-card__badge {
  font-family: 'JetBrains Mono', monospace; font-size: 0.68rem;
  background: var(--bg); border: 1px solid var(--line-2);
  padding: 2px 7px; border-radius: 4px; color: var(--blue);
}
.upload-card__desc { font-size: 0.78rem; color: var(--ink-3); margin: 0; }

/* ── File picker ── */
.file-picker {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  padding: 18px 12px; height: 90px;
  border: 1px dashed var(--line-2); border-radius: 8px;
  background: var(--bg); text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.file-picker:hover { border-color: var(--ink-4); background: rgba(13,14,18,0.6); }
.file-picker.ready { border-color: rgba(74,222,128,0.45); border-style: solid; }
.file-picker.error { border-color: rgba(251,113,133,0.45); border-style: solid; }
.file-picker input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.file-picker__idle {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--ink-3);
}
.file-picker__formats { font-size: 0.7rem; color: var(--ink-4); font-family: 'JetBrains Mono', monospace; }
.file-picker__ok { color: var(--green); font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.file-picker__err {
  color: var(--rose); font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Controls row ── */
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.status-hint {
  font-size: 0.82rem; color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Generate button ── */
.btn-generate {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px; border: none;
  background: var(--ink); color: var(--bg);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.btn-generate:hover:not([disabled]) { background: white; transform: translateY(-1px); }
.btn-generate[disabled] { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ── Error message ── */
.error-msg {
  margin-top: 14px; padding: 10px 14px;
  background: rgba(251,113,133,0.07); border: 1px solid rgba(251,113,133,0.22);
  border-radius: 7px; color: var(--rose); font-size: 0.83rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Stats strip ── */
.stats-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  margin-bottom: 16px;
}
.stat-cell { padding: 16px; border-right: 1px solid var(--line); }
.stat-cell:last-child { border-right: 0; }
.stat-cell__val {
  font-family: 'JetBrains Mono', monospace; font-size: 1.55rem; font-weight: 600;
  background: linear-gradient(180deg, #fff, #888a96);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1; margin-bottom: 5px;
}
.stat-cell__lbl { font-size: 0.73rem; color: var(--ink-3); }

/* ── Download panel ── */
.download-panel {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin-bottom: 14px;
}
.download-panel h3 { margin: 0 0 12px; font-size: 0.92rem; font-weight: 600; }
.download-list { display: grid; gap: 0; }
.download-item {
  font-family: 'JetBrains Mono', monospace; font-size: 0.79rem;
  color: var(--blue); cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
  transition: color .15s;
}
.download-item:last-child { border-bottom: 0; }
.download-item:hover { color: var(--ink); }
.download-item__count { color: var(--ink-4); margin-left: auto; font-size: 0.72rem; }

/* ── Report / details ── */
.report-block { margin-top: 14px; }
.report-block summary {
  cursor: pointer; display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 8px; font-size: 0.86rem; font-weight: 500; list-style: none;
}
.report-block summary::-webkit-details-marker { display: none; }
.report-block[open] summary { border-radius: 8px 8px 0 0; border-bottom-color: transparent; }
.report-block__body {
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 8px 8px; overflow: hidden;
}
.report-block summary span.hint { font-size: 0.8rem; color: var(--ink-3); font-weight: 400; }

/* ── Log ── */
.log-container {
  padding: 14px 16px; background: var(--bg);
  max-height: 220px; overflow: auto;
  display: grid; gap: 3px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.79rem;
}
.log-container p { margin: 0; color: var(--amber); }

/* ── Tables ── */
.table-shell { overflow: auto; max-height: 300px; }
.table-shell--medium { max-height: 220px; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--bg-3); font-weight: 600; z-index: 1; font-size: 0.78rem; color: var(--ink-3); }

/* ── Form elements ── */
.control-group { display: grid; gap: 6px; }
.control-group label { font-size: 0.85rem; color: var(--ink-2); font-weight: 500; }
.control-group--wide { grid-column: 1 / -1; }
.controls-grid { display: grid; gap: 14px; }

textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2);
  color: var(--ink); border-radius: 8px; padding: 10px 12px;
  font-size: 0.86rem; font-family: 'JetBrains Mono', monospace;
  resize: vertical; line-height: 1.6;
}
textarea:focus { outline: none; border-color: var(--ink-4); }

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 0.88rem; color: var(--ink-2);
}
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }

/* ── Colour helpers ── */
.ok { color: var(--green); }
.warn { color: var(--amber); }
.bad { color: var(--rose); }

/* ── Tool page footer ── */
.tool-footer {
  padding: 28px 0; margin-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.79rem; color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
}
code {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.85em;
  color: var(--blue);
}
