:root {
  --bg: #050604;
  --side: #090a07;
  --surface: #10110d;
  --surface-2: #171812;
  --surface-3: #202118;
  --line: #343325;
  --line-2: #514c36;
  --text: #f5f1e7;
  --muted: #a8a08e;
  --soft: #756d5c;
  --gold: #d4af57;
  --gold-2: #f2d077;
  --green: #58d68d;
  --cyan: #63c7d9;
  --red: #d45a52;
  --shadow: rgba(0, 0, 0, .42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 52% -20%, rgba(212, 175, 87, .14), transparent 34rem),
    linear-gradient(180deg, #050604, #070806);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 760;
}

button:hover {
  border-color: var(--gold);
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

a {
  color: inherit;
  text-decoration: none;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090a07;
  color: var(--text);
  padding: 12px;
  resize: vertical;
}

textarea:focus,
input:focus {
  outline: 1px solid rgba(212, 175, 87, .65);
}

.agent-os {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 380px;
}

.side,
.inspector {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: rgba(9, 10, 7, .94);
  border-color: var(--line);
}

.side {
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inspector {
  border-left: 1px solid var(--line);
  padding: 18px 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}

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

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(212, 175, 87, .7);
  background:
    linear-gradient(135deg, #17140a, #32240d),
    #17140a;
  color: var(--gold-2);
  font-weight: 900;
  border-radius: 9px;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand small,
.eyebrow,
.message-meta,
.rail-footer,
.proof-list,
.status-list span,
.status-list small,
.identity-panel p,
.target span,
.estate span {
  color: var(--muted);
}

.brand small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
}

.new-thread {
  width: 100%;
  color: #120f08;
  background: var(--gold);
  border-color: var(--gold);
}

.side nav,
.side-block,
.quick-actions,
.skill-list {
  display: grid;
  gap: 6px;
}

.side nav a,
.side-block button {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.side nav a:hover,
.side nav a.active,
.side-block button:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface);
}

.side-block {
  padding-top: 4px;
}

.skill-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.skill-list span {
  min-height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold-2);
  font-size: 12px;
  background: rgba(255,255,255,.025);
}

.rail-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--soft);
}

.status-dot.ok {
  background: var(--green);
  box-shadow: 0 0 16px rgba(88, 214, 141, .5);
}

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

.chat-main {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 22px;
}

.topbar,
.conversation-head,
.panel-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  min-height: 72px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 900;
}

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

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.mode-group {
  display: flex;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  padding: 4px;
}

.mode {
  min-width: 56px;
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.mode.active {
  color: #120f08;
  background: var(--gold);
  border-color: var(--gold);
}

.conversation {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(16, 17, 13, .78);
  box-shadow: 0 20px 48px var(--shadow);
}

.conversation-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

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

.thread {
  min-height: 420px;
  padding: 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  width: min(820px, 100%);
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0c0d0a;
}

.message.user {
  align-self: flex-end;
  border-color: rgba(212, 175, 87, .45);
  background: #151207;
}

.message.assistant {
  border-color: rgba(99, 199, 217, .35);
}

.message strong {
  color: var(--gold-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.message p {
  white-space: pre-wrap;
  line-height: 1.52;
  color: #eee9dd;
}

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

.composer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
}

.secondary {
  color: var(--gold-2);
}

.ghost {
  background: transparent;
  color: var(--muted);
}

.panel,
.drawer-section {
  border: 1px solid var(--line);
  background: rgba(16, 17, 13, .86);
  border-radius: 10px;
  box-shadow: 0 16px 34px var(--shadow);
}

.panel {
  padding: 14px;
}

.identity-panel {
  background:
    linear-gradient(180deg, rgba(212,175,87,.09), rgba(16,17,13,.86)),
    var(--surface);
}

.identity-panel p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.panel-head.compact {
  margin-bottom: 10px;
}

.status-list {
  display: grid;
  gap: 8px;
}

.status-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.status-list div:first-child {
  border-top: 0;
}

.status-list span,
.status-list small {
  font-size: 11px;
}

.status-list small {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.status-list strong {
  color: var(--text);
  font-size: 13px;
}

.quick-actions button {
  text-align: left;
}

.receipt {
  min-height: 160px;
  max-height: 380px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #040504;
  color: #c8f7df;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.drawer-section {
  width: min(1196px, calc(100% - 40px));
  margin: 18px auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}

.split {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr);
}

.target-grid,
.estate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.target,
.estate {
  min-height: 128px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  padding: 13px;
}

.target strong,
.estate strong {
  display: block;
  font-size: 14px;
}

.target span,
.estate span {
  display: block;
  margin: 7px 0 10px;
  font-size: 12px;
  line-height: 1.4;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  background: rgba(255,255,255,.025);
}

.chip.ok,
.pill.ok {
  color: var(--green);
  border-color: rgba(88, 214, 141, .4);
}

.chip.warn,
.pill.warn {
  color: var(--gold-2);
  border-color: rgba(212, 175, 87, .45);
}

.chip.bad,
.pill.danger {
  color: var(--red);
  border-color: rgba(212, 90, 82, .5);
}

.local-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.local-actions {
  margin-top: 10px;
}

.proof-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .agent-os {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .inspector {
    position: static;
    grid-column: 1 / -1;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .target-grid,
  .estate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .side,
  .inspector {
    position: static;
    height: auto;
  }

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

  .inspector,
  .split,
  .composer-actions,
  .local-toolbar {
    grid-template-columns: 1fr;
  }

  .chat-main {
    padding: 12px;
  }

  .topbar,
  .conversation-head,
  .section-head {
    align-items: stretch;
    display: grid;
  }

  .target-grid,
  .estate-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
