:root {
  color-scheme: dark;
  --bg: #141816;
  --panel: #1e2420;
  --panel-strong: #252d28;
  --line: #3b473f;
  --text: #f3f0e8;
  --muted: #b9b4a9;
  --accent: #78d6b0;
  --accent-2: #f2c76e;
  --danger: #ee8d7a;
  --input: #101411;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(120, 214, 176, 0.08), transparent 34%),
    linear-gradient(300deg, rgba(242, 199, 110, 0.08), transparent 30%),
    var(--bg);
}

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

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel-strong);
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

code {
  color: #d9f5ea;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  width: min(1360px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.console-panel,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(30, 36, 32, 0.94);
  box-shadow: var(--shadow);
}

.console-panel {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(37, 45, 40, 0.72);
}

.eyebrow {
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.state-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--input);
  font-size: 0.86rem;
  white-space: nowrap;
}

.state-pill {
  border-color: rgba(120, 214, 176, 0.7);
  color: #c7f7e4;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
}

.entry {
  max-width: 860px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(20, 24, 22, 0.84);
}

.entry.user {
  align-self: flex-end;
  border-color: rgba(242, 199, 110, 0.58);
}

.entry.system {
  align-self: flex-start;
}

.entry strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-2);
  font-size: 0.82rem;
}

.entry pre {
  overflow-x: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: #0c100d;
  color: #d9f5ea;
  line-height: 1.45;
  white-space: pre-wrap;
}

.command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: rgba(37, 45, 40, 0.72);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--input);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 92px;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.section-block {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.section-block:last-child {
  border-bottom: 0;
}

.section-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.quick-actions,
.memory-form {
  display: grid;
  gap: 10px;
}

.memory-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.memory-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(16, 20, 17, 0.72);
}

.memory-item b {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
}

.locked-note {
  color: var(--danger);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 720px);
    margin: 10px auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .command-form {
    grid-template-columns: 1fr;
  }
}
