:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #171a1f;
  --muted: #667085;
  --line: #d9dee7;
  --blue: #0f62fe;
  --blue-dark: #0043ce;
  --green: #198038;
  --amber: #b28600;
  --red: #da1e28;
  --shadow: 0 18px 50px rgba(18, 28, 45, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.sidebar {
  background: #111827;
  color: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--blue);
  font-weight: 800;
  border-radius: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
}

.brand p {
  margin: 3px 0 0;
  color: #b9c3d3;
  line-height: 1.35;
  font-size: 13px;
}

.upload-zone {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #6b7280;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  color: #f8fafc;
  cursor: pointer;
}

.upload-zone input {
  display: none;
}

.upload-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #253045;
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.upload-zone span:last-child {
  color: #b9c3d3;
  font-size: 13px;
}

.status-panel {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  background: #1f2937;
}

.status-panel span {
  color: #cbd5e1;
  font-size: 13px;
}

.status-panel strong {
  font-size: 18px;
}

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

.nav-item {
  width: 100%;
  text-align: left;
  color: #dbe4ef;
  background: transparent;
  border-radius: 8px;
  padding: 12px 14px;
}

.nav-item.active,
.nav-item:hover {
  background: #253045;
  color: #fff;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.primary,
.ghost,
.icon-btn {
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

.primary {
  color: #fff;
  background: var(--blue);
}

.primary:hover {
  background: var(--blue-dark);
}

.ghost,
.icon-btn {
  color: var(--ink);
  background: #eef2f7;
  border: 1px solid var(--line);
}

.small {
  min-height: 34px;
  font-size: 13px;
}

.wide {
  width: 100%;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

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

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 14px;
}

.panel {
  min-height: 420px;
  overflow: hidden;
}

.panel.full {
  min-height: calc(100vh - 138px);
}

.panel-head {
  height: 58px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

.panel h3 {
  margin: 0;
  font-size: 17px;
}

.compact-input {
  width: 180px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.map,
.file-list,
.report,
.answers,
.markdown {
  padding: 16px;
}

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

.map-grid {
  display: grid;
  gap: 12px;
}

.lane {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lane h4 {
  margin: 0;
  padding: 12px;
  background: #f1f4f8;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.lane ul,
.checklist {
  margin: 0;
  padding: 12px 12px 12px 30px;
}

.lane li,
.checklist li {
  margin: 5px 0;
}

.file-list {
  max-height: 600px;
  overflow: auto;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
}

.file-row strong {
  word-break: break-word;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf5ff;
  color: #0043ce;
  font-weight: 700;
  font-size: 12px;
}

.chat {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: calc(100vh - 196px);
}

.answers {
  overflow: auto;
}

.answer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.answer-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.answer-body {
  line-height: 1.55;
}

.answer-body pre,
.markdown {
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.prompt-row input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.field {
  display: grid;
  gap: 8px;
  padding: 16px 16px 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#impactBtn {
  margin: 16px;
  width: calc(100% - 32px);
}

.report {
  overflow: auto;
  max-height: 620px;
  line-height: 1.55;
}

.generator-grid {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.generator {
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 16px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.generator:hover {
  border-color: var(--blue);
}

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

.markdown {
  margin: 0;
  max-height: 620px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.bob-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
}

.bob-layout h4 {
  margin: 0 0 12px;
}

code {
  background: #eef2f7;
  border-radius: 5px;
  padding: 2px 5px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .metrics,
  .split,
  .bob-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}
