:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --surface: #fffaf1;
  --ink: #1d201c;
  --muted: #6e7169;
  --line: #d6cdbc;
  --green: #0f7b55;
  --blue: #285f7a;
  --red: #b3432f;
  --amber: #b77a20;
  --violet: #625077;
  --shadow: 0 18px 44px rgba(33, 30, 25, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(29, 32, 28, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 32, 28, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: "Avenir Next", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 241, 232, 0.95);
  backdrop-filter: blur(12px);
}

.brand,
.actions,
.panel-head,
.map-head,
.board-head,
.candidate-top,
.candidate-actions,
.claim-top,
.claim-actions,
.verification-strip {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.mark {
  position: relative;
  width: 46px;
  height: 46px;
  border: 1px solid var(--ink);
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--ink);
}

.mark i {
  position: absolute;
  display: block;
  height: 2px;
  background: var(--ink);
  transform-origin: center;
}

.mark i:nth-child(1) {
  width: 33px;
  left: 6px;
  top: 23px;
}

.mark i:nth-child(2) {
  width: 34px;
  left: 7px;
  top: 16px;
  transform: rotate(32deg);
}

.mark i:nth-child(3) {
  width: 34px;
  left: 7px;
  top: 30px;
  transform: rotate(-32deg);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  line-height: 1.1;
}

h2 {
  font-size: 15px;
  line-height: 1.25;
}

.actions {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 36px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(29, 32, 28, 0.85);
}

.button.primary {
  background: var(--red);
  color: white;
}

.button.danger {
  background: #ffe5df;
  color: var(--red);
}

.button.ghost {
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted);
}

.button.full {
  width: 100%;
  margin-top: 10px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(620px, 1fr) 460px;
  gap: 16px;
  padding: 16px;
}

.sidebar,
.prompt-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.panel,
.rent-map,
.scoring,
.plane-board,
.candidate-board,
.claim-board {
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.97);
  box-shadow: var(--shadow);
}

.panel,
.scoring,
.plane-board,
.candidate-board,
.claim-board {
  padding: 14px;
}

.panel-head,
.map-head,
.board-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.status,
.note,
.ledger-entry p {
  color: var(--muted);
  font-size: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(179, 67, 47, 0.12);
}

.checks {
  display: grid;
  gap: 9px;
}

.time-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.checks label,
.candidate-actions label {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.checks input,
.candidate-actions input {
  width: 16px;
  height: 16px;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

.badge.neutral {
  background: #ece4d4;
  color: var(--muted);
}

.badge.safe {
  background: #dff4ea;
  color: var(--green);
}

.badge.risky {
  background: #ffe0d6;
  color: var(--red);
}

.note {
  margin: 12px 0 0;
  line-height: 1.45;
}

.note.error {
  color: var(--red);
  font-weight: 800;
}

.mini-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.steps {
  display: grid;
  gap: 8px;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-areas:
    "num title"
    "num desc";
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.92);
  padding: 9px;
  text-align: left;
}

.step span {
  grid-area: num;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ece4d4;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.step b {
  grid-area: title;
  color: var(--ink);
  font-size: 13px;
}

.step small {
  grid-area: desc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.step.active {
  border-color: var(--ink);
  background: #fffdf8;
  box-shadow: 3px 3px 0 rgba(29, 32, 28, 0.15);
}

.step.active span {
  background: var(--ink);
  color: white;
}

.stage {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.workflow-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.workflow-guide article {
  min-height: 104px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.97);
  padding: 13px;
  box-shadow: 5px 5px 0 rgba(29, 32, 28, 0.08);
}

.workflow-guide span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 9px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.workflow-guide strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.workflow-guide small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.time-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.97);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.time-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.time-readout span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.time-readout strong {
  color: var(--ink);
}

.rent-map {
  padding: 16px;
  overflow: hidden;
}

.score-pill {
  display: grid;
  justify-items: end;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 8px 10px;
  min-width: 100px;
}

.score-pill span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.score-pill strong {
  font-size: 26px;
  line-height: 1;
}

.rent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  position: relative;
}

.rent-grid::before,
.rent-grid::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 74%;
  height: 2px;
  background: rgba(29, 32, 28, 0.16);
  transform: translate(-50%, -50%) rotate(34deg);
  pointer-events: none;
}

.rent-grid::after {
  transform: translate(-50%, -50%) rotate(-34deg);
}

.rent-card {
  position: relative;
  z-index: 1;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
  box-shadow: 4px 4px 0 rgba(29, 32, 28, 0.08);
}

.rent-card span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.urgent { border-top: 5px solid var(--red); }
.blocker { border-top: 5px solid var(--blue); }
.durability { border-top: 5px solid var(--green); }
.question { border-top: 5px solid var(--amber); }

.sliders {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.sliders label {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
  color: var(--ink);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--red);
}

.candidate-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.claim-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.plane-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.plane-grid span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 18px;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.candidate-card,
.claim-card {
  border: 0;
  border-left: 4px solid var(--ink);
  border-radius: 0;
  background: #fffdf8;
  padding: 16px 18px;
}

.candidate-top,
.claim-top {
  gap: 8px;
  margin-bottom: 8px;
}

.claim-top {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.claim-status::before {
  content: "/";
  margin-right: 8px;
  color: var(--line);
}

.claim-status[data-status="model_verified"],
.claim-status[data-status="human_verified"] {
  color: var(--green);
}

.claim-status[data-status="stale"],
.claim-status[data-status="rejected"] {
  color: var(--red);
}

.candidate-top {
  align-items: flex-start;
}

.candidate-title-block {
  display: grid;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.candidate-name {
  color: var(--ink);
  font-size: 25px;
  font-weight: 900;
  line-height: 1.15;
  margin: 0;
  overflow-wrap: anywhere;
}

.candidate-identity,
.candidate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.candidate-rent-pool {
  display: block;
  max-width: 100%;
  border-left: 4px solid var(--blue);
  color: var(--ink);
  padding: 2px 0 2px 9px;
  margin: 6px 0 12px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.candidate-ticker {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.candidate-role {
  color: var(--green);
}

.candidate-market::before,
.candidate-role::before,
.candidate-market-access::before,
.candidate-price-reflected::before,
.candidate-priced-label::before {
  content: "/";
  margin-right: 10px;
  color: var(--line);
}

.candidate-body {
  display: grid;
  gap: 10px;
}

.candidate-body section {
  border-top: 1px solid rgba(214, 205, 188, 0.8);
  padding-top: 9px;
}

.candidate-body strong {
  display: block;
  margin-bottom: 4px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.candidate-body p {
  min-height: 22px;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.candidate-meta {
  margin-top: 10px;
}

.candidate-actions,
.claim-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.candidate-card .button.ghost,
.claim-card .button.ghost {
  min-height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.claim-actions {
  justify-content: space-between;
}

.coverage-gaps {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.gap-head,
.gap-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gap-head {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.gap-head strong {
  font-size: 14px;
}

.gap-head span,
.gap-top span {
  border: 1px solid #f0c4ba;
  border-radius: 999px;
  background: #ffe5df;
  color: var(--red);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

.coverage-gap {
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fffdf8;
  padding: 11px;
}

.coverage-gap p,
.coverage-gap dl {
  margin: 8px 0 0;
}

.coverage-gap p,
.coverage-gap dd {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.coverage-gap dt {
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.coverage-gap dd {
  margin: 3px 0 0;
}

.verification-strip {
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.verification-strip span {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.gate-state.open {
  color: var(--green);
}

.gate-state.blocked {
  color: var(--red);
}

.claim-text {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.source-block {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(214, 205, 188, 0.8);
  padding-top: 10px;
}

.source-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.source-meta-line,
.source-verify-line,
.source-url-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.source-meta-line,
.source-verify-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-date::before,
.source-id::before,
.source-verified-at::before {
  content: "/";
  margin-right: 10px;
  color: var(--line);
}

.source-block section {
  display: grid;
  gap: 4px;
  margin-top: 2px;
}

.source-block section strong {
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.source-block section p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.source-link {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.source-link.disabled {
  color: var(--muted);
  pointer-events: none;
}

.prompt-panel {
  position: sticky;
  top: 92px;
}

#promptBox {
  min-height: 390px;
  background: #1f211d;
  color: #f8f0dc;
  border-color: #1f211d;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
}

#llmOutput {
  margin-top: 6px;
}

.ledger-band {
  padding: 0 16px 24px;
}

.ledger-panel {
  padding: 16px;
}

.ledger {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ledger-entry {
  border-left: 3px solid var(--red);
  background: #fffdf8;
  padding: 10px;
}

.ledger-entry strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.ledger-entry p {
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 1220px) {
  .layout {
    grid-template-columns: 280px minmax(420px, 1fr);
  }

  .prompt-rail {
    grid-column: 1 / -1;
  }

  .prompt-panel {
    position: static;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar,
  .map-head,
  .board-head,
  .time-gate {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .ledger-band {
    padding: 0 12px 18px;
  }

  .rent-grid,
  .workflow-guide,
  .time-controls,
  .sliders,
  .plane-grid,
  .candidate-cards,
  .claim-cards,
  .ledger {
    grid-template-columns: 1fr;
  }
}
