/* Knowledge Graph Explorer — Whitefriar theme */

:root {
  /* Brand tokens */
  --background: #ffffff;
  --foreground: #0b1220;
  --blue-primary: #0171ff;
  --blue-deep: #0f2060;
  --blue-darker: #0b1220;
  --blue-purple: #4240ce;
  --surface: #f7f9fc;
  --border: #d2d8e0;
  --border-light: #e4e7ed;
  --text-muted: #546078;
  --text-subtle: #8a94a6;

  --hero-grad: radial-gradient(125% 125% at 50% 0, #152570 0%, #0f2060 55%, #0a1240 100%);
  --shadow-card: 0 12px 40px rgba(15, 32, 96, 0.15);
  --shadow-lift: 0 20px 50px rgba(11, 18, 32, 0.28);

  --pill: 9999px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 10px;
}

* { box-sizing: border-box; }

/* Explicit display rules below would otherwise beat the [hidden] attribute. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-primary); }

.wf-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wf-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.wf-narrow { max-width: 860px; }

/* ── Typography ───────────────────────────────────────────── */

.wf-h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 60px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: #fff;
}

.wf-h2 {
  margin: 0;
  font-size: clamp(30px, 4.4vw, 56px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--blue-primary);
}

.wf-lede {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 17px;
}

/* ── Nav ──────────────────────────────────────────────────── */

.wf-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.wf-nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.wf-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--foreground);
}

.wf-logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--blue-primary), var(--blue-purple));
  box-shadow: inset -6px -6px 0 0 rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}

.wf-logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wf-nav-links {
  display: flex;
  gap: 24px;
  margin-left: 12px;
}

.wf-nav-links a {
  color: var(--foreground);
  text-decoration: none;
  font-size: 15px;
}

.wf-nav-links a:hover { color: var(--blue-primary); }

.wf-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* ── Pills ────────────────────────────────────────────────── */

.wf-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--pill);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.wf-pill:active { transform: translateY(1px); }

.wf-pill-primary { background: var(--blue-primary); color: #fff; }
.wf-pill-primary:hover { background: #0160db; }

.wf-pill-deep { background: var(--blue-deep); color: #fff; }
.wf-pill-deep:hover { background: #16307f; }

.wf-pill-outline {
  background: transparent;
  color: var(--blue-deep);
  border-color: var(--border);
}
.wf-pill-outline:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
.wf-pill-outline.is-active { background: var(--blue-primary); border-color: var(--blue-primary); color: #fff; }

.wf-pill-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
}
.wf-pill-ghost:hover { background: rgba(255, 255, 255, 0.2); }

:where(a, button, input, summary):focus-visible {
  outline: 2px solid var(--blue-primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.wf-hero :where(a, button, input):focus-visible { outline-color: #7fb4ff; }

/* ── Hero ─────────────────────────────────────────────────── */

.wf-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 96px;
  background: var(--hero-grad);
  overflow: hidden;
}

/* Faint starfield-style highlight, echoing the site's hero glow */
.wf-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(2px 2px at 12% 32%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 82% 24%, rgba(255, 255, 255, 0.4), transparent 60%),
    radial-gradient(1.5px 1.5px at 68% 70%, rgba(255, 255, 255, 0.3), transparent 60%),
    radial-gradient(2px 2px at 26% 78%, rgba(255, 255, 255, 0.28), transparent 60%);
  pointer-events: none;
}

.wf-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.wf-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  padding: 7px 16px 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 500;
}

.wf-eyebrow-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-primary);
  box-shadow: 0 0 0 4px rgba(1, 113, 255, 0.22);
}

.wf-hero-sub {
  margin: 20px auto 0;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 17px;
}

/* ── Search bar ───────────────────────────────────────────── */

#kg-search-container { margin-top: 38px; }

#search-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.wf-searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 620px;
  padding: 8px 8px 8px 10px;
  border-radius: var(--pill);
  background: #fff;
  box-shadow: var(--shadow-lift);
}

#kg-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 15px;
}

#kg-search::placeholder { color: var(--text-subtle); }
#kg-search:focus { outline: none; }
#kg-search::-webkit-search-cancel-button { cursor: pointer; }

#kg-search-submit {
  flex-shrink: 0;
  padding: 13px 22px;
  border: 0;
  border-radius: var(--pill);
  background: var(--blue-primary);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease;
}

#kg-search-submit:hover:not(:disabled) { background: #0160db; }
#kg-search-submit:disabled { opacity: 0.7; cursor: default; }

.wf-arrow { display: inline-block; margin-left: 2px; }

.wf-beta {
  flex-shrink: 0;
  padding: 5px 13px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wf-hero-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.wf-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  cursor: pointer;
}

.wf-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue-primary);
  cursor: pointer;
}

.wf-textlink {
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.wf-textlink:hover { color: #fff; }

/* ── API key panel (glass on dark) ────────────────────────── */

.wf-glass {
  max-width: 620px;
  margin: 22px auto 0;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.wf-glass-note {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.6;
}

.wf-glass-note:last-of-type { margin-bottom: 0; }
.wf-glass-note strong { color: #fff; }

.key-row {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

#kg-api-key {
  flex: 1 1 200px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--pill);
  background: rgba(11, 18, 32, 0.4);
  color: #fff;
  font: inherit;
  font-size: 14px;
}

#kg-api-key::placeholder { color: rgba(255, 255, 255, 0.4); }

.wf-key-status {
  margin: 12px 0 0;
  color: #7fb4ff;
  font-size: 13px;
  font-weight: 600;
  min-height: 1.2em;
}

/* ── Section shell (mirrors the brand's py-24 white bands) ─── */

.wf-section { padding: 96px 0; background: #fff; }
.wf-section-tint { background: var(--surface); }

/* Tinted band used by the Wikidata form page */
.wf-band {
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.wf-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

.wf-section-lead { max-width: 720px; margin-bottom: 56px; }
.wf-section-lead .wf-lede { margin-top: 14px; }

/* Two-column split: navy panel beside content */
.wf-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

/* ── Navy stat panel ──────────────────────────────────────── */

.wf-panel {
  position: sticky;
  top: 96px;
  padding: 32px;
  border-radius: var(--r-lg);
  background: var(--blue-deep);
  color: #fff;
}

.wf-panel-title {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.wf-panel-score {
  padding: 20px 22px;
  margin-bottom: 12px;
  border-radius: var(--r-md);
  background: #fff;
}

.wf-panel-score-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.wf-panel-score-num {
  margin: 4px 0 14px;
  color: var(--blue-primary);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.wf-panel-score-max {
  margin-left: 8px;
  color: var(--text-subtle);
  font-size: 17px;
  font-weight: 500;
}

/* Progress meter — 8px pill on a #e4e7ed track */
.wf-meter {
  height: 8px;
  border-radius: var(--pill);
  background: var(--border-light);
  overflow: hidden;
}

.wf-meter-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--pill);
  background: var(--blue-primary);
  transition: width 0.5s ease;
}

.wf-panel-rows { display: flex; flex-direction: column; gap: 10px; }

.wf-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text-muted);
  font-size: 14px;
}

.wf-panel-row b {
  color: var(--foreground);
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wf-panel-row b.is-good { color: #16a34a; }
.wf-panel-row b.is-blue { color: var(--blue-primary); }

.wf-panel-cta { width: 100%; margin-top: 20px; }

/* ── Result cards ─────────────────────────────────────────── */

#kg-results-grid { display: flex; flex-direction: column; gap: 18px; }

.kg-result-card {
  padding: 28px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kg-result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 48px rgba(15, 32, 96, 0.2);
}

.kg-card-top { display: flex; align-items: flex-start; gap: 18px; }

.kg-img {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface);
}

.entity-name {
  margin: 0 0 8px;
  color: var(--blue-primary);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.kg-types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }

.kg-type {
  padding: 3px 11px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.kg-score-block { margin: 18px 0; }

.kg-score-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.kg-score-label { color: var(--text-muted); font-size: 13px; font-weight: 600; }

.kg-score-value {
  color: var(--blue-primary);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kg-score-value.is-high { color: var(--blue-purple); }

.kg-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.kg-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px;
}

.kg-row-label { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.kg-row-value { color: var(--foreground); text-align: right; word-break: break-word; }

.kg-desc {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
}

.kg-link { color: var(--blue-primary); font-weight: 600; text-decoration: none; }
.kg-link:hover { text-decoration: underline; }

.kg-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.kg-card-actions > a { text-decoration: none; }

/* ── Sample-data badge ────────────────────────────────────── */

.kg-badge {
  align-self: flex-start;
  padding: 6px 15px;
  border-radius: var(--pill);
  background: rgba(66, 64, 206, 0.1);
  border: 1px solid rgba(66, 64, 206, 0.25);
  color: var(--blue-purple);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Tracked entities ─────────────────────────────────────── */

#kg-tracked-grid { display: flex; flex-direction: column; gap: 12px; }

.kg-tracked-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: #fff;
}

.kg-tracked-name {
  color: var(--foreground);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.kg-tracked-meta { margin-top: 2px; color: var(--text-subtle); font-size: 13px; }
.kg-tracked-actions { display: flex; gap: 8px; flex-shrink: 0; }

.kg-home-flag {
  margin-left: 10px;
  padding: 3px 11px;
  border-radius: var(--pill);
  background: var(--blue-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
}

code {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
}


/* ── Footer ───────────────────────────────────────────────── */

.wf-footer {
  padding: 48px 0;
  background: var(--blue-darker);
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.wf-footer .wf-logo { color: #fff; justify-content: center; }
.wf-footer .wf-logo-text { color: #fff; }

.wf-footer p {
  margin: 14px 0 0;
  font-size: 13px;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 860px) {
  .wf-nav-links { display: none; }
}

/* Stack the two-column split before the panel gets too narrow to read */
@media (max-width: 940px) {
  .wf-split { grid-template-columns: 1fr; gap: 36px; }
  .wf-panel { position: static; }
  .wf-section { padding: 72px 0; }
  .wf-section-lead { margin-bottom: 36px; }
}

@media (max-width: 680px) {
  .wf-hero { min-height: 0; padding: 92px 20px 64px; }
  .wf-shell { padding: 0 20px; }

  #search-bar { flex-direction: column; gap: 14px; }

  .wf-searchbar {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: var(--r-lg);
  }

  #kg-search { width: 100%; text-align: center; }
  #kg-search-submit { width: 100%; }

  .wf-nav-actions .wf-pill-deep { display: none; }

  .kg-card-top { flex-direction: column; gap: 12px; }
  .kg-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .kg-row-value { text-align: left; }
  .kg-card-actions { flex-direction: column; align-items: stretch; }

  .kg-tracked-item { flex-direction: column; align-items: flex-start; }

  .wf-section { padding: 56px 0; }
  .wf-panel { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   Wikidata form
   ══════════════════════════════════════════════════════════════ */

.wf-hero-compact { min-height: 0; padding: 118px 24px 76px; }

.wf-eyebrow-code {
  padding: 1px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.16);
  border: 0;
  color: #fff;
  font-size: 11px;
}

/* ── Layout ───────────────────────────────────────────────── */

#wd-form { padding: 64px 0 72px; }

.wd-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

.wd-sidebar {
  position: sticky;
  top: 84px;
  padding: 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: var(--surface);
}

.wd-sidebar-title {
  margin: 0 0 12px;
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

#wd-section-nav {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

#wd-section-nav li { color: var(--text-subtle); font-size: 12px; }

#wd-section-nav a {
  color: var(--text-muted);
  font-size: 14px;
  text-decoration: none;
}

#wd-section-nav a:hover { color: var(--blue-primary); }

.wd-sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}

.wd-sidebar-actions .wf-pill { padding: 8px 15px; font-size: 13px; }

.wd-autosave {
  margin: 12px 0 0;
  color: var(--text-subtle);
  font-size: 12px;
}

/* ── Sections ─────────────────────────────────────────────── */

.wd-section {
  padding: 30px;
  margin-bottom: 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: 0 2px 12px rgba(15, 32, 96, 0.05);
  scroll-margin-top: 88px;
}

.wd-section-head {
  display: flex;
  gap: 18px;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.wd-section-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--pill);
  background: linear-gradient(140deg, var(--blue-primary), var(--blue-purple));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.wd-section-title {
  margin: 0;
  color: var(--foreground);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wd-section-intro {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Fixed statement ──────────────────────────────────────── */

.wd-fixed {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding: 12px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  flex-wrap: wrap;
}

.wd-fixed-label { color: var(--foreground); font-size: 14px; font-weight: 600; }
.wd-fixed-note { color: var(--text-subtle); font-size: 13px; }

/* ── Field grid ───────────────────────────────────────────── */

.wd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
  gap: 24px;
}

.wd-field { min-width: 0; }
.wd-field.is-wide { grid-column: 1 / -1; }

.wd-field-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.wd-label {
  color: var(--foreground);
  font-size: 14px;
  font-weight: 600;
}

.wd-prop {
  padding: 1px 7px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.wd-prop:hover { border-color: var(--blue-primary); color: var(--blue-primary); }

.wd-required {
  color: #c2410c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.wd-help {
  margin: 0 0 9px;
  color: var(--text-subtle);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ── Inputs ───────────────────────────────────────────────── */

.wd-input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
}

.wd-input::placeholder { color: var(--text-subtle); }

.wd-input:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(1, 113, 255, 0.14);
}

.wd-textarea { resize: vertical; line-height: 1.6; }

.wd-mono { display: flex; gap: 8px; }
.wd-mono .wd-lang { max-width: 82px; text-align: center; }

.wd-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
}

.wd-check-input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--blue-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Entity picker ────────────────────────────────────────── */

.wd-entity { position: relative; }

.wd-entity.is-resolved .wd-entity-input {
  border-color: var(--blue-primary);
  padding-right: 76px;
}

.wd-entity-chip {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  padding: 2px 9px;
  border-radius: var(--pill);
  background: var(--blue-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.wd-entity-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 264px;
  overflow-y: auto;
  margin: 0;
  padding: 5px;
  list-style: none;
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: 0 12px 34px rgba(15, 32, 96, 0.18);
}

.wd-entity-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 8px 11px;
  border-radius: 7px;
  cursor: pointer;
}

.wd-entity-option:hover,
.wd-entity-option:focus {
  background: var(--surface);
  outline: none;
}

.wd-entity-label { color: var(--foreground); font-size: 14px; font-weight: 600; }

.wd-entity-qid {
  color: var(--blue-primary);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.wd-entity-desc {
  grid-column: 1 / -1;
  color: var(--text-subtle);
  font-size: 12.5px;
}

.wd-entity-empty {
  padding: 10px 12px;
  color: var(--text-subtle);
  font-size: 13px;
}

/* ── Repeatable rows ──────────────────────────────────────── */

.wd-multi-rows, .wd-group-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wd-multi-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wd-multi-row > *:first-child { flex: 1 1 auto; min-width: 0; }

.wd-group-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
  padding: 16px 42px 16px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.wd-group-cell { min-width: 0; }
.wd-group-cell.is-main { grid-column: 1 / -1; }
.wd-group-cell.is-check { grid-column: 1 / -1; }

.wd-sub-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.wd-row-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: #fff;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.wd-group-row > .wd-row-remove {
  position: absolute;
  top: 12px;
  right: 12px;
}

.wd-row-remove:hover {
  background: #c2410c;
  border-color: #c2410c;
  color: #fff;
}

.wd-add {
  align-self: flex-start;
  margin-top: 10px;
  padding: 7px 15px;
  border: 1px dashed var(--border);
  border-radius: var(--pill);
  background: transparent;
  color: var(--blue-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wd-add:hover { border-color: var(--blue-primary); background: rgba(1, 113, 255, 0.05); }

/* ── Output ───────────────────────────────────────────────── */

#wd-output { padding: 72px 0 84px; }

.wd-output-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 22px;
  flex-wrap: wrap;
}

.wd-copy-status { color: var(--blue-primary); font-size: 13px; font-weight: 600; }

.wd-output-panes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.wd-pane {
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: #fff;
  overflow: hidden;
}

.wd-pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
}

.wd-pane-head h3 {
  margin: 0;
  color: var(--blue-deep);
  font-size: 15px;
  font-weight: 800;
}

.wd-pane-meta { color: var(--text-subtle); font-size: 12px; }

.wd-code {
  margin: 0;
  padding: 20px;
  max-height: 460px;
  overflow: auto;
  background: var(--blue-darker);
  color: #cfe0ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
  tab-size: 4;
}

.wd-code:focus-visible { outline: 2px solid var(--blue-primary); outline-offset: -2px; }

/* ── Issues ───────────────────────────────────────────────── */

.wd-issues {
  margin-bottom: 22px;
  padding: 20px 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: #fff;
}

.wd-issues.is-clean {
  border-left: 3px solid #15803d;
  color: #15803d;
  font-weight: 600;
}

.wd-issues.is-clean p { margin: 0; font-size: 14px; }

.wd-issue-group + .wd-issue-group { margin-top: 18px; }

.wd-issue-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wd-issue-group.is-error h4 { color: #c2410c; }
.wd-issue-group.is-warn h4 { color: #a16207; }

.wd-issue-group ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wd-issue-group li { color: var(--text-muted); font-size: 14px; line-height: 1.6; }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 940px) {
  .wd-layout { grid-template-columns: 1fr; gap: 24px; }
  .wd-sidebar { position: static; }
  #wd-section-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding-left: 16px;
  }
}

@media (max-width: 680px) {
  .wf-hero-compact { padding: 52px 20px 60px; }
  .wd-section { padding: 22px 18px; }
  .wd-section-head { gap: 14px; }
  .wd-grid { grid-template-columns: 1fr; gap: 20px; }
  .wd-group-row { grid-template-columns: 1fr; }
}
