:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #5f6b76;
  --line: #d9e0e4;
  --accent: #126b5a;
  --accent-dark: #0d4f43;
  --warn: #9a5b13;
  --danger: #a33a2f;
  --info: #2f5f8f;
  --shadow: 0 12px 28px rgba(21, 35, 48, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  min-height: 40px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  background: #b8c1c7;
  cursor: default;
}

button.secondary {
  background: #eef2f4;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: #e3e9ec;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  background: #18232c;
  color: white;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

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

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #d7f0e9;
  color: #0d4f43;
  flex: 0 0 auto;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
}

.brand p {
  margin: 4px 0 0;
  color: #b6c2cc;
  font-size: 13px;
}

.token-field {
  display: grid;
  gap: 6px;
  color: #d5dde4;
  font-size: 13px;
}

.token-field input {
  width: 100%;
  border: 1px solid #3c4a56;
  background: #101820;
  color: white;
  border-radius: 7px;
  padding: 10px;
}

.run-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 7px;
  background: #2a3945;
}

.run-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.run-item {
  border: 1px solid #31404c;
  background: #202d37;
  color: white;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  display: grid;
  gap: 6px;
}

.run-item:hover,
.run-item.active {
  background: #2d3d49;
}

.run-item strong {
  font-size: 14px;
}

.run-item span {
  color: #c7d0d8;
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 520px);
  gap: 18px;
  padding: 18px;
  min-width: 0;
}

.chat-area,
.detail-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

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

.messages {
  padding: 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 8px;
  background: #edf4f2;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: #e9eef5;
}

.quick-actions {
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-actions button {
  background: #eef2f4;
  color: var(--ink);
  border: 1px solid var(--line);
  min-height: 36px;
  padding: 8px 12px;
}

.quick-actions button:hover {
  background: #e3e9ec;
}

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

.composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

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

.detail-header {
  border-bottom: 1px solid var(--line);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.detail-header h2 {
  font-size: 18px;
  margin: 0;
}

.detail-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-content {
  padding: 16px;
  overflow: auto;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: #edf1f3;
  color: var(--info);
}

.status.high {
  color: var(--danger);
  background: #f8e9e7;
}

.status.medium {
  color: var(--warn);
  background: #fbf0df;
}

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.kv div:first-child {
  color: var(--muted);
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f0f3f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
}

ol {
  padding-left: 22px;
}

li {
  margin: 8px 0;
}

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

  .sidebar {
    min-height: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .chat-area,
  .detail-pane {
    min-height: 560px;
  }
}
