:root {
  --bg: #f5f6f2;
  --ink: #20251f;
  --muted: #657064;
  --line: #d8ddd2;
  --panel: #ffffff;
  --accent: #256c63;
  --accent-2: #b44d2e;
  --pv: #1f9f55;
  --npv: #d2a53f;
  --be: #a06b4f;
  --uncertain: #4d5967;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  min-height: 86px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

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

h2 {
  margin-bottom: 14px;
  font-size: 16px;
}

h3 {
  margin-bottom: 0;
  font-size: 13px;
}

.status-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.repo-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.repo-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status-strip span {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 87px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 18px;
  background: #eef1ea;
}

.panel,
.map-panel,
.phase,
.code-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.drop {
  display: block;
  margin-bottom: 12px;
}

.drop span,
.control span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

input[type="file"] {
  width: 100%;
  border: 1px dashed #aeb9aa;
  border-radius: 8px;
  background: #fbfcf8;
  padding: 10px;
  font-size: 12px;
}

select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  padding: 8px 10px;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#runInference {
  width: 100%;
}

#runInference {
  margin-top: 14px;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #edf0e9;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.segmented button,
.tabs button {
  border: 0;
  background: transparent;
}

.segmented button.active,
.tabs button.active {
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(30, 40, 30, 0.12);
}

.control input {
  width: 100%;
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.data-browser {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #edf0e9;
}

.data-browser-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.data-browser-head span {
  color: var(--muted);
  font-size: 12px;
}

.data-file-list {
  display: grid;
  gap: 8px;
}

.data-file-empty {
  padding: 10px 12px;
  border: 1px dashed #c7d0c1;
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.data-file-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.data-file-meta {
  min-width: 0;
}

.data-file-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.data-file-desc {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.data-file-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.data-file-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.legend {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #edf0e9;
}

.legend:last-child {
  border-bottom: 0;
}

.legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.pv {
  background: var(--pv);
}

.npv {
  background: var(--npv);
}

.be {
  background: var(--be);
}

.uncertain {
  background: var(--uncertain);
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px;
  background: #e9ede4;
  border-radius: 8px;
  overflow-x: auto;
}

.tabs button {
  padding: 9px 12px;
  white-space: nowrap;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.map-grid,
.band-layout,
.phase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.map-panel {
  padding: 14px;
}

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

.panel-head h2 {
  margin: 0;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.canvas-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: #dfe4dc;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
}

canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.stacked canvas {
  position: absolute;
  inset: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metrics div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.text-panel {
  line-height: 1.5;
}

.text-panel ul {
  padding-left: 18px;
}

.top-bands {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.top-bands div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #edf0e9;
  padding-bottom: 8px;
}

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

.phase,
.code-card {
  padding: 18px;
}

.phase span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  margin-bottom: 12px;
}

.phase p,
.code-card p {
  color: var(--muted);
  line-height: 1.5;
}

code {
  display: block;
  overflow-x: auto;
  background: #20251f;
  color: #eff7e9;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
}

.code-card {
  margin-top: 16px;
}

.roadmap {
  display: grid;
  gap: 12px;
}

.road {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 5px solid #b8c0b2;
  border-radius: 8px;
  padding: 16px;
}

.road.active {
  border-left-color: var(--accent);
}

.road span {
  color: var(--muted);
}

@media (max-width: 960px) {
  .layout,
  .map-grid,
  .band-layout,
  .phase-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .data-file-card {
    grid-template-columns: 1fr;
  }

  .data-file-actions {
    justify-content: flex-start;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}