:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #191c1f;
  --panel-2: #202429;
  --line: #333942;
  --text: #f2f1ed;
  --muted: #a8adb4;
  --accent: #35c29c;
  --warn: #e5b454;
  --bad: #ef6b73;
  --blue: #77a8ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #252a30;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: #56606d;
  background: #2d333a;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #15181b;
  padding: 18px;
  min-height: 0;
  overflow: auto;
}

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

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--text);
  color: #101214;
  font-weight: 800;
}

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

h1 {
  font-size: 17px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand p,
.topbar p {
  color: var(--muted);
}

.statusPanel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: 18px;
}

.statusRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.ok {
  background: var(--accent);
}

.dot.bad {
  background: var(--bad);
}

label {
  display: block;
  color: var(--muted);
  margin-bottom: 7px;
}

.projectActions {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
}

.projectActions span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.historyPanel {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr);
  gap: 10px;
  margin-top: 18px;
  min-height: 260px;
}

.historyHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.historyHeader span,
.emptyHistory {
  color: var(--muted);
  font-size: 12px;
}

.historyList {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.historyItem {
  display: grid;
  gap: 4px;
  width: 100%;
  height: auto;
  min-height: 82px;
  padding: 9px;
  text-align: left;
}

.historyItem strong,
.historyItem span,
.historyItem small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.historyItem strong {
  white-space: nowrap;
  font-size: 13px;
}

.historyItem span {
  color: var(--muted);
  font-size: 11px;
}

.historyItem small {
  display: -webkit-box;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 8px;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) minmax(180px, 30vh);
  gap: 14px;
  padding: 16px;
  min-width: 0;
}

.topbar,
.paneHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.promptGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 0;
}

.pane,
.consoleWrap {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

textarea,
pre {
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  border: 1px solid #2c333b;
  border-radius: 6px;
  background: #0f1113;
  color: var(--text);
  padding: 12px;
  overflow: auto;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.event {
  color: var(--blue);
}

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

  .workspace {
    grid-template-rows: auto minmax(520px, 1fr) minmax(220px, 30vh);
  }

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