:root {
  --bg: #0b1020;
  --panel: #121a2c;
  --panel-2: #172236;
  --line: #26324a;
  --text: #e8edf7;
  --muted: #92a0b8;
  --accent: #2dd4bf;
  --accent-2: #f59e0b;
  --danger: #fb7185;
  --ok: #34d399;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 330px minmax(420px, 1fr) 380px;
}

.sidebar,
.monitor {
  background: #0f1728;
  border-right: 1px solid var(--line);
  padding: 20px;
  overflow-y: auto;
  max-height: 100vh;
}

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

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  color: #031018;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

.brand h1,
.topbar h2,
.monitor h2 {
  font-size: 18px;
  font-weight: 750;
}

.brand p,
.topbar p,
.monitor p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.panel-title {
  font-size: 13px;
  color: #c9d4e8;
  font-weight: 700;
  margin-bottom: 12px;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0b1221;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 11px;
  outline: none;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  max-height: 100vh;
}

.topbar,
.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 40, 0.8);
}

.status-pill {
  min-width: 86px;
  text-align: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill.busy {
  color: var(--accent-2);
  border-color: rgba(245, 158, 11, 0.5);
}

.status-pill.ok {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.5);
}

.status-pill.error {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.5);
}

.chat-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
}

.messages {
  overflow-y: auto;
  padding: 22px;
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.message.user .avatar {
  grid-column: 2;
  background: #334155;
}

.message.user .bubble {
  grid-row: 1;
  background: #183447;
  border-color: rgba(45, 212, 191, 0.25);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #15342f;
  color: var(--accent);
  font-weight: 800;
}

.bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: #dbe5f5;
  line-height: 1.7;
  white-space: pre-wrap;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 12px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
  background: #0f1728;
}

.composer textarea {
  min-height: 72px;
  max-height: 180px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #06211e;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 11px;
  font-size: 12px;
}

.record-list {
  display: grid;
  gap: 8px;
  padding: 14px 0;
}

.record-item {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 8px;
}

.record-item.active {
  border-color: var(--accent);
}

.record-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.record-question {
  font-size: 12px;
  color: #dbe5f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  color: var(--muted);
}

.tag.success {
  color: var(--ok);
}

.tag.error {
  color: var(--danger);
}

.record-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 230px;
  padding: 12px;
}

.empty-detail {
  color: var(--muted);
  font-size: 13px;
}

.detail-block {
  margin-bottom: 14px;
}

.detail-block h3 {
  margin: 0 0 7px;
  color: #c9d4e8;
  font-size: 12px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #dbe5f5;
  background: #0b1221;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
}

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

  .monitor {
    grid-column: 1 / -1;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

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

  .sidebar,
  .monitor,
  .workspace {
    max-height: none;
  }

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