:root {
  --bg: #181410;
  --surface: #211b16;
  --surface-2: #17120e;
  --surface-3: #2a231c;
  --line: #3a3128;
  --line-soft: #2d251e;
  --text: #efeae0;
  --muted: #948c7d;
  --muted-2: #c8c2b3;
  --accent: #e0884a;
  --danger: #cf6b5f;
  --unsupported: #746b5e;
  --weak: #e0884a;
  --supported: #9bc070;
  --load: #efeae0;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.48 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  align-items: center;
  background: rgba(24, 20, 16, 0.94);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  display: flex;
  gap: 24px;
  height: 54px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: baseline;
  display: inline-flex;
  gap: 9px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  color: var(--accent);
  font-size: 21px;
  line-height: 1;
}

.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.topbar nav a {
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
}

.topbar nav a.active,
.topbar nav a:hover {
  background: var(--surface-3);
  border-color: var(--line);
  color: var(--text);
}

.shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 18px;
}

.page-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 24px;
  margin-bottom: 0;
}

h2 {
  font-size: 15px;
  margin-bottom: 10px;
}

h3 {
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0 6px;
  text-transform: uppercase;
}

.subhead,
.muted {
  color: var(--muted);
}

.button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  min-height: 32px;
  padding: 5px 10px;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #17120e;
}

.button.danger {
  color: var(--danger);
}

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

.filters,
.form,
.inline-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
}

.inline-form {
  border: 0;
  margin-bottom: 0;
  padding: 0;
}

.admin-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
}

.admin-form {
  background: transparent;
  border: 0;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 12px;
  padding: 0;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
}

.data-table th,
.data-table td {
  border-top: 1px solid var(--line-soft);
  padding: 7px 0;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.data-table code {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 12px;
}

.filters {
  grid-template-columns: minmax(220px, 1fr) 160px 160px auto;
}

input,
select,
textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  font: inherit;
  min-height: 32px;
  padding: 6px 8px;
  width: 100%;
}

textarea {
  resize: vertical;
}

select:empty {
  min-height: 32px;
}

label span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.list,
.claim-list {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.claim-row,
.queue-row,
.review-plan-row {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  min-height: 42px;
  padding: 7px 10px;
}

.claim-row {
  grid-template-columns: 86px 82px 92px 190px minmax(220px, 1fr);
}

.queue-row {
  grid-template-columns: 86px 170px 220px minmax(220px, 1fr);
}

.review-plan-row {
  grid-template-columns: 86px 110px 92px 112px minmax(220px, 1fr);
}

.claim-row:last-child,
.queue-row:last-child,
.review-plan-row:last-child {
  border-bottom: 0;
}

.claim-row:hover,
.queue-row:hover,
.review-plan-row:hover,
.js-row.is-selected {
  background: var(--surface-3);
}

.ref {
  font-family: var(--mono);
  font-weight: 700;
}

.type,
.status,
.confidence,
.chip {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
  white-space: nowrap;
}

.type,
.status,
.chip {
  background: var(--surface-3);
  color: var(--muted-2);
}

.confidence {
  color: #17120e;
  text-align: center;
}

.confidence.band-unsupported,
.confidence.band-load-bearing {
  color: var(--bg);
}

.band-unsupported {
  background: var(--unsupported);
}

.band-weakly-held {
  background: var(--weak);
}

.band-well-supported {
  background: var(--supported);
}

.band-load-bearing {
  background: var(--load);
}

.body {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  background: var(--surface);
  color: var(--muted);
  padding: 18px;
}

.detail-grid,
.two-col {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 340px;
  margin-bottom: 12px;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
}

.main-panel {
  min-height: 220px;
}

.claim-body {
  font-size: 16px;
  white-space: pre-wrap;
}

.confidence-large {
  align-items: center;
  border-radius: 5px;
  color: var(--bg);
  display: inline-flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 7px 10px;
}

.confidence-large.band-unsupported {
  color: var(--text);
}

.link-row {
  border-top: 1px solid var(--line);
  display: block;
  padding: 7px 0;
}

.link-row.challenge {
  color: var(--danger);
}

.event {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.event:first-of-type {
  border-top: 0;
}

.event.compact {
  padding: 8px 0;
}

.event-head {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.sparkline {
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex;
  gap: 3px;
  height: 72px;
  margin-bottom: 10px;
  padding: 8px;
}

.sparkline span {
  background: var(--accent);
  display: block;
  min-height: 2px;
  width: 8px;
}

.graph-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr) 300px;
  margin-bottom: 12px;
  overflow: hidden;
}

.graph-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 10px;
}

.segmented {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: flex;
  padding: 2px;
}

.segmented button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  min-height: 28px;
  padding: 4px 9px;
}

.segmented button.is-active {
  background: var(--surface-3);
  color: var(--text);
}

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

.graph-stage {
  min-height: 620px;
  position: relative;
}

.graph-shell.is-compact .graph-stage {
  min-height: 420px;
}

.graph-stage svg {
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 28px 28px;
  display: block;
  height: 100%;
  min-height: inherit;
  width: 100%;
}

.graph-inspector {
  border-left: 1px solid var(--line);
  min-height: 620px;
  padding: 12px;
}

.graph-shell.is-compact .graph-inspector {
  min-height: 420px;
}

.graph-inspector-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.graph-inspector p {
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.graph-inspector-empty {
  color: var(--muted);
}

.graph-chain {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.graph-chain-row {
  display: grid;
  gap: 6px;
  grid-template-columns: 78px minmax(0, 1fr);
  padding: 6px 0;
}

.graph-chain-row span:last-child {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-edge {
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 2;
  transition: opacity 120ms ease, stroke-width 120ms ease;
}

.graph-edge.edge-depends_on {
  stroke: var(--load);
}

.graph-edge.edge-rejected_alternative_of {
  stroke: var(--weak);
  stroke-dasharray: 7 5;
}

.graph-edge.edge-challenges {
  stroke: var(--danger);
  stroke-dasharray: 4 4;
}

.graph-edge.is-highlighted {
  stroke-width: 3.5;
}

.graph-edge.is-muted,
.graph-edge-label.is-muted {
  opacity: 0.18;
}

.graph-edge-label {
  fill: var(--muted);
  font: 11px var(--sans);
  paint-order: stroke;
  pointer-events: none;
  stroke: var(--bg);
  stroke-width: 4px;
}

.graph-node {
  cursor: grab;
  outline: none;
}

.graph-node:active,
.graph-shell.is-dragging .graph-node {
  cursor: grabbing;
}

.graph-node circle {
  fill: var(--surface-2);
  stroke-width: 4;
  transition: filter 120ms ease, opacity 120ms ease, stroke-width 120ms ease;
}

.graph-node.band-unsupported circle {
  stroke: var(--unsupported);
}

.graph-node.band-weakly-held circle {
  stroke: var(--weak);
}

.graph-node.band-well-supported circle {
  stroke: var(--supported);
}

.graph-node.band-load-bearing circle {
  stroke: var(--load);
}

.graph-node.is-focal circle,
.graph-node.is-selected circle {
  filter: drop-shadow(0 4px 8px rgba(224, 136, 74, 0.18));
  stroke-width: 6;
}

.graph-node.is-hovered circle,
.graph-node.is-related circle {
  filter: drop-shadow(0 3px 7px rgba(224, 136, 74, 0.14));
}

.graph-node.is-muted {
  opacity: 0.24;
}

.graph-node text {
  fill: var(--text);
  font: 700 12px var(--mono);
  pointer-events: none;
}

.graph-node .graph-node-confidence {
  fill: var(--muted);
  font: 11px var(--sans);
}

.graph-tooltip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: var(--text);
  max-width: 250px;
  padding: 8px 9px;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.graph-tooltip-ref {
  font-family: var(--mono);
  font-weight: 700;
  margin-bottom: 4px;
}

.graph-tooltip-body,
.graph-tooltip-confidence {
  color: var(--muted-2);
  font-size: 12px;
}

.graph-tooltip-body {
  margin-bottom: 4px;
}

.review-filters {
  grid-template-columns: 180px auto;
  justify-content: start;
}

.review-detail .main-panel {
  min-height: 140px;
}

.review-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.node-list {
  display: grid;
  gap: 10px;
}

.plan-node {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.plan-node:first-child {
  border-top: 0;
  padding-top: 0;
}

.node-head,
.form-row,
.edge-row,
.check-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.node-head {
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.next-node {
  display: grid;
  gap: 8px;
}

.claim-body.small {
  font-size: 14px;
}

.compact-text {
  margin-bottom: 6px;
}

.node-complete {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 10px;
  padding: 10px;
}

.form-row {
  align-items: end;
}

.form-row label {
  flex: 1;
  min-width: 0;
}

.stacked {
  margin-bottom: 18px;
}

.checkbox-list,
.edge-list {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.check-row {
  color: var(--text);
  font-size: 13px;
}

.check-row input {
  min-height: auto;
  width: auto;
}

.edge-row {
  align-items: start;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
  padding-top: 8px;
}

.edge-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.landing-shell {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.landing-topbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  margin: 0 auto;
  max-width: 1160px;
  padding: 16px 32px;
}

.landing-wordmark {
  align-items: baseline;
  display: flex;
  gap: 10px;
  font-size: 19px;
  font-weight: 600;
}

.landing-kanji {
  color: var(--accent);
  font-size: 25px;
  line-height: 1;
}

.landing-topbar nav {
  align-items: center;
  display: flex;
  gap: 24px;
  margin-left: auto;
}

.landing-topbar nav a,
.landing-caption,
.landing-kicker,
.landing-legend,
.landing-band,
.landing-role {
  font-family: var(--mono);
}

.landing-topbar nav a {
  color: var(--muted);
  font-size: 12px;
}

.landing-topbar nav a:hover {
  color: var(--text);
}

.landing-main {
  margin: 0 auto;
  max-width: 1160px;
  padding: 0 32px;
}

.landing-hero {
  align-items: center;
  display: grid;
  gap: 72px;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  padding: 92px 0 60px;
}

.landing-kicker {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1.2px;
  margin-bottom: 26px;
  text-transform: uppercase;
}

.landing-copy h1 {
  font-size: 72px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 0.98;
  margin: 0 0 30px;
  max-width: 9ch;
}

.landing-copy h1 em {
  color: var(--accent);
  font-style: normal;
}

.landing-lede {
  color: var(--muted-2);
  font-size: 19px;
  line-height: 1.45;
  margin: 0 0 34px;
  max-width: 32ch;
}

.landing-ctas {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.landing-pill {
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: 2px;
  color: var(--bg);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 8px 14px;
}

.landing-pill.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.landing-demo,
.landing-examples article {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 8px 8px 0 var(--surface-2);
}

.landing-demo {
  padding: 22px 24px;
}

.landing-caption {
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  display: block;
  font-size: 10.5px;
  letter-spacing: 1px;
  padding-bottom: 13px;
  text-transform: uppercase;
}

.landing-chat {
  display: grid;
  gap: 0;
}

.landing-turn {
  padding-top: 14px;
}

.landing-turn + .landing-turn {
  border-top: 1px dashed var(--line-soft);
  margin-top: 14px;
}

.landing-role {
  color: var(--muted);
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.7px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.landing-role.tashikame,
.landing-role span {
  color: var(--accent);
}

.landing-turn p,
.landing-examples p {
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}

.landing-ref {
  font-family: var(--mono);
  white-space: nowrap;
}

.landing-ref.weak,
.landing-band.weak {
  color: var(--weak);
}

.landing-ref.supported,
.landing-band.supported {
  color: var(--supported);
}

.landing-ref.load,
.landing-band.load {
  color: var(--load);
}

.landing-band.unsupported {
  color: var(--muted);
}

.landing-bands {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  padding: 26px 0;
}

.landing-legend {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.landing-band {
  font-size: 11.5px;
  letter-spacing: 0.5px;
}

.landing-examples {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
  padding: 48px 0 72px;
}

.landing-examples article {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
}

.landing-examples .landing-role {
  margin-top: 14px;
}

.landing-examples p {
  color: var(--muted-2);
  font-size: 14.5px;
}

.landing-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-family: var(--mono);
  font-size: 11px;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1160px;
  padding: 18px 32px;
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
    height: auto;
    padding: 10px;
  }

  .filters,
  .detail-grid,
  .two-col,
  .review-grid,
  .admin-grid,
  .claim-row,
  .queue-row,
  .graph-shell,
  .review-plan-row {
    grid-template-columns: 1fr;
  }

  .graph-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented {
    overflow-x: auto;
  }

  .graph-inspector {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 0;
  }

  .form-row,
  .edge-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .body {
    white-space: normal;
  }

  .landing-topbar,
  .landing-topbar nav,
  .landing-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .landing-topbar {
    gap: 12px;
    padding: 14px 20px;
  }

  .landing-topbar nav {
    gap: 12px;
    margin-left: 0;
  }

  .landing-main {
    padding: 0 20px;
  }

  .landing-hero,
  .landing-examples {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    gap: 36px;
    padding: 56px 0 40px;
  }

  .landing-copy h1 {
    font-size: 46px;
  }
}
