:root {
  --bg: #050505;
  --fg: #f8f8f8;
  --muted: #a8a8a8;
  --line: #2b2b2b;
  --soft: #111;
  --soft-2: #191919;
  --button-bg: #f8f8f8;
  --button-fg: #050505;
  --danger: #d8d8d8;
}

body.light {
  --bg: #f7f7f7;
  --fg: #050505;
  --muted: #555;
  --line: #d0d0d0;
  --soft: #fff;
  --soft-2: #ededed;
  --button-bg: #050505;
  --button-fg: #f8f8f8;
  --danger: #222;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

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

button,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.panel {
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.process-panel {
  border-right: 1px solid var(--line);
  background: var(--soft);
}

.chat-panel {
  background: var(--bg);
}

.topbar {
  min-height: 72px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 650;
}

.icon-button,
.text-button,
.composer button {
  border: 1px solid var(--fg);
  background: var(--button-bg);
  color: var(--button-fg);
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
}

.icon-button {
  width: 48px;
  padding: 0;
  font-weight: 700;
}

.text-button {
  background: transparent;
  color: var(--fg);
}

.process-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1.35fr) minmax(120px, 0.65fr) auto;
  gap: 14px;
  padding: 18px 24px 24px;
  overflow: hidden;
}

.process-note {
  padding: 14px 16px;
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.process-section {
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.section-label {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.process-stream,
.action-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

.memory-state {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  max-height: 84px;
  overflow-y: auto;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.process-entry {
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.5;
}

.process-entry:last-child {
  border-bottom: 0;
}

.process-time,
.action-time {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 7px;
}

.action-item {
  margin: 0 0 10px;
  padding: 10px 11px;
  border-left: 2px solid var(--fg);
  background: var(--soft);
  line-height: 1.42;
  font-size: 14px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: 82%;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: var(--soft);
  line-height: 1.48;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.message.assistant {
  align-self: flex-start;
  background: var(--soft-2);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}

textarea {
  width: 100%;
  min-height: 68px;
  max-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--fg);
  padding: 14px 16px;
  outline: none;
}

textarea:focus {
  border-color: var(--fg);
}

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

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 45dvh 55dvh;
  }

  .panel {
    height: auto;
  }

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

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

  .message {
    max-width: 100%;
  }
}
