:root {
  --paper-bg: #1a1a1a;
  --paper-base: rgba(38, 38, 38, 0.92);
  --paper-strong: rgba(48, 48, 48, 0.96);
  --paper-muted: rgba(34, 34, 34, 0.88);
  --ink: #f0e6c0;
  --ink-soft: #c4b88a;
  --ink-faint: #8a7e5a;
  --border: rgba(230, 200, 80, 0.10);
  --line-strong: rgba(230, 200, 80, 0.18);
  --accent: #e6c850;
  --accent-soft: rgba(230, 200, 80, 0.12);
  --accent-2: #f0d870;
  --accent-2-soft: rgba(240, 216, 112, 0.10);
  --warn: #e6a830;
  --warn-soft: rgba(230, 168, 48, 0.14);
  --danger: #d46a5a;
  --danger-soft: rgba(212, 106, 90, 0.14);
  --success: #7ab648;
  --success-soft: rgba(122, 182, 72, 0.12);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.25);
  --radius: 24px;
  --radius-sm: 16px;
  --gutter: 1.25rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100%;
  font-family: "Geist", "Inter", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(230, 200, 80, 0.04), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(60, 60, 60, 0.6), transparent 20rem),
    linear-gradient(180deg, #141414 0%, var(--paper-bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(230, 200, 80, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 200, 80, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 25% 25%, rgba(230, 200, 80, 0.03) 0, transparent 42%),
    radial-gradient(circle at 70% 70%, rgba(230, 200, 80, 0.02) 0, transparent 28%);
  background-size: 28px 28px, 28px 28px, 100% 100%, 100% 100%;
  opacity: 0.65;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

button {
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(230, 200, 80, 0.55);
  outline-offset: 3px;
}

.app-body {
  overflow: hidden;
}

.app-chrome {
  position: relative;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) minmax(360px, 26vw);
  height: 100vh;
  min-height: 100vh;
}

.nav-rail {
  position: sticky;
  top: 0;
  height: 100vh;
}

.nav-rail {
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.25rem 1rem 1rem;
  background:
    linear-gradient(180deg, rgba(24, 24, 24, 0.97), rgba(30, 30, 30, 0.95)),
    radial-gradient(circle at top, rgba(230, 200, 80, 0.04), transparent 24rem);
  border-right: 1px solid rgba(230, 200, 80, 0.08);
  color: var(--ink);
}

.rail-brand {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  margin-bottom: 0.35rem;
  color: inherit;
  text-decoration: none;
}

.rail-brand:hover {
  text-decoration: none;
}

.rail-brand-text {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.rail-nav {
  display: grid;
  gap: 0.35rem;
}

.rail-link {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.35rem;
  border-radius: 0.85rem;
  color: var(--ink-faint);
  transition: background 180ms ease, color 180ms ease;
}

.rail-link:hover {
  text-decoration: none;
  background: rgba(230, 200, 80, 0.06);
  color: var(--ink-soft);
}

.rail-link.is-active {
  background: rgba(230, 200, 80, 0.10);
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}

.rail-link-quiet {
  margin-top: 0.45rem;
}

.rail-glyph {
  font-family: "Geist Mono", monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.rail-copy {
  display: grid;
  justify-items: center;
  gap: 0.18rem;
  text-align: center;
}

.rail-copy strong,
.rail-copy small {
  display: block;
}

.rail-copy strong {
  font-size: 0.72rem;
  font-weight: 500;
}

.rail-copy small {
  font-size: 0.64rem;
  color: var(--ink-faint);
}

.workspace {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 1rem 1rem 1.35rem;
}

.workspace-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: rgba(32, 32, 32, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.workspace-context {
  display: grid;
  gap: 0.2rem;
}

.workspace-context h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.4rem);
  letter-spacing: -0.04em;
}

.workspace-copy {
  margin: 0;
  max-width: 48rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

button,
.button-link {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, #2e2e2e, #262626);
  color: var(--ink);
  font-weight: 600;
  padding: 0.85rem 1.15rem;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button-link:hover {
  text-decoration: none;
}

.inline-button-link {
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
}

.subtle-action,
button.subtle-action,
.button-link.subtle-action {
  background: rgba(38, 38, 38, 0.68);
  border-color: var(--border);
  color: var(--ink-soft);
  box-shadow: none;
}


button[type="submit"] {
  background: linear-gradient(135deg, var(--accent), #c4a830);
  color: #1a1a1a;
  border-color: transparent;
}

.danger-button {
  padding: 0.5rem 0.8rem;
  border-radius: 0.8rem;
  background: var(--danger-soft);
  border: 1px solid rgba(212, 106, 90, 0.20);
  color: #e8a098;
  box-shadow: none;
}

.danger-button:hover {
  background: rgba(212, 106, 90, 0.24);
}

.inline-action-form {
  margin: 0;
}

.workspace-main {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.workspace-main::-webkit-scrollbar {
  display: none;
}

.flash-stack {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(38, 38, 38, 0.92);
  border: 1px solid rgba(122, 182, 72, 0.22);
  box-shadow: var(--shadow-soft);
}

.card,
.panel,
.muted-box,
.feed-item,
.operator-message {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--paper-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card::before,
.panel::before,
.muted-box::before,
.feed-item::before,
.operator-message::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(230, 200, 80, 0.06), transparent 35%),
    repeating-linear-gradient(
      115deg,
      rgba(230, 200, 80, 0.02) 0,
      rgba(230, 200, 80, 0.02) 1px,
      transparent 1px,
      transparent 18px
    ),
    repeating-linear-gradient(
      20deg,
      rgba(230, 200, 80, 0.012) 0,
      rgba(230, 200, 80, 0.012) 1px,
      transparent 1px,
      transparent 14px
    );
  opacity: 0.88;
  z-index: -1;
}

.card {
  padding: 1.15rem;
}

.panel,
.muted-box,
.feed-item,
.operator-message {
  padding: 0.95rem;
  border-radius: var(--radius-sm);
  box-shadow: none;
  background: var(--paper-strong);
}

.hero-card {
  background:
    linear-gradient(135deg, rgba(42, 42, 42, 0.92), rgba(34, 34, 34, 0.88)),
    var(--paper-base);
}

.hero-card::after,
.accent-card::after,
.feed-card::after {
  content: "";
  position: absolute;
  right: -2.5rem;
  top: -1.5rem;
  width: 11rem;
  height: 11rem;
  border-radius: 2rem;
  background:
    linear-gradient(135deg, rgba(230, 200, 80, 0.14), rgba(240, 216, 112, 0.06));
  clip-path: polygon(25% 0, 100% 0, 80% 100%, 0 75%);
  opacity: 0.9;
}

.grid,
.stack,
.feed-list,
.project-list,
.stats-grid,
.mini-card-grid,
.list-grid,
.form-grid {
  display: grid;
  gap: var(--gutter);
}

.stack {
  gap: 0.9rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}

.bento-span-12 {
  grid-column: span 12;
}

.bento-span-8 {
  grid-column: span 8;
}

.bento-span-7 {
  grid-column: span 7;
}

.bento-span-6 {
  grid-column: span 6;
}

.bento-span-5 {
  grid-column: span 5;
}

.bento-span-4 {
  grid-column: span 4;
}

.bento-span-3 {
  grid-column: span 3;
}

.hero-slab {
  display: grid;
  gap: 1rem;
}

.hero-slab h2,
.hero-slab h3,
.hero-slab h1,
.section-head h2,
.section-head h3,
.card h1,
.card h2,
.card h3,
.panel h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.hero-slab p,
.card p,
.panel p {
  line-height: 1.55;
}

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

.subtle,
.empty,
th,
.workspace-copy,
.rail-copy small {
  color: var(--ink-faint);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.meta-row,
.hero-actions,
.connection-row,
.tag-row,
.stat-ribbon,
.action-row,
.table-action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.stat-ribbon {
  gap: 0.85rem;
}

.stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(32, 32, 32, 0.92);
  border: 1px solid var(--border);
}

.metric-card h3 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  font-size: clamp(1.7rem, 2vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
}

.metric-note {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.signal-good {
  color: var(--success);
}

.signal-warn {
  color: var(--warn);
}

.signal-bad {
  color: var(--danger);
}

.signal-neutral {
  color: var(--ink-faint);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.45rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: rgba(38, 38, 38, 0.60);
  color: var(--ink-faint);
  font-size: 0.73rem;
  font-weight: 500;
}

.badge.status-badge {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-badge::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  color: currentColor;
}

.status-badge.status-info::before,
.status-badge.status-running::before,
.status-badge.status-pending::before {
  content: "i";
}

.status-badge.status-success::before,
.status-badge.status-completed::before {
  content: "+";
}

.status-badge.status-error::before,
.status-badge.status-failed::before {
  content: "x";
}

.status-badge.status-warning::before {
  content: "!";
}

.status-badge-label {
  font-weight: 700;
}

.badge.warning,
.badge.score-ok {
  background: var(--warn-soft);
  color: #e6b840;
}

.badge.score-good,
.badge.success {
  background: var(--success-soft);
  color: #8ad460;
}

.badge.score-poor,
.badge.error {
  background: var(--danger-soft);
  color: #e8a098;
}

.badge.score-na {
  background: rgba(60, 60, 60, 0.5);
  color: var(--ink-faint);
}

.badge.info {
  background: var(--accent-soft);
  color: var(--accent);
}

form.stack label,
.stack label,
.form-grid label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  padding: 0.8rem 0.92rem;
  background: rgba(28, 28, 28, 0.95);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

textarea {
  min-height: 6.2rem;
  resize: vertical;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.checkbox input {
  width: auto;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.85fr 1fr auto;
  gap: 0.65rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.table-action-cell {
  justify-content: space-between;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(30, 30, 30, 0.55);
}

th,
td {
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: var(--accent-soft);
}

.list-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.list-card {
  display: grid;
  gap: 0.6rem;
}

.list-card p,
.feed-item p,
.operator-message p {
  margin: 0.2rem 0 0;
  white-space: pre-wrap;
}

.feed-list {
  gap: 0.9rem;
}

.feed-list-bounded {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 200, 80, 0.35) rgba(255, 255, 255, 0.04);
  transition: box-shadow 160ms ease;
}

.feed-list-bounded.has-scroll-top {
  box-shadow: inset 0 20px 18px -18px rgba(20, 20, 20, 0.92);
}

.feed-list-bounded.has-scroll-bottom {
  box-shadow: inset 0 -20px 18px -18px rgba(20, 20, 20, 0.92);
}

.feed-list-bounded.has-scroll-top.has-scroll-bottom {
  box-shadow:
    inset 0 20px 18px -18px rgba(20, 20, 20, 0.92),
    inset 0 -20px 18px -18px rgba(20, 20, 20, 0.92);
}

.feed-list-bounded::-webkit-scrollbar,
.agent-feed::-webkit-scrollbar {
  width: 0.55rem;
}

.feed-list-bounded::-webkit-scrollbar-track,
.agent-feed::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.feed-list-bounded::-webkit-scrollbar-thumb,
.agent-feed::-webkit-scrollbar-thumb {
  background: rgba(230, 200, 80, 0.34);
  border-radius: 999px;
}

.feed-item-top,
.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.feed-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  align-items: flex-start;
}

.feed-item-actions .subtle-action {
  padding: 0.45rem 0.72rem;
  border-radius: 0.8rem;
  font-size: 0.76rem;
}

.timestamp-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
  font-family: "Geist Mono", monospace;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.timestamp-cluster {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  position: relative;
  font-variant-numeric: tabular-nums;
}

.timestamp-cluster time {
  font-variant-numeric: tabular-nums;
}

.timestamp-offset-badge {
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 160ms ease, transform 160ms ease;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  background: rgba(230, 200, 80, 0.14);
  color: var(--accent);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timestamp-cluster:hover .timestamp-offset-badge,
.timestamp-cluster:focus-within .timestamp-offset-badge {
  opacity: 1;
  transform: translateY(0);
}

.timestamp-extra {
  color: var(--ink-faint);
}

.feed-card,
.accent-card {
  background:
    linear-gradient(180deg, rgba(42, 42, 42, 0.95), rgba(36, 36, 36, 0.9)),
    var(--paper-base);
}

.code-block,
.feed-item pre {
  margin: 0;
  padding: 0.95rem;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: #1f2126;
  color: #f4f3ee;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: "Geist Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.55;
}

.muted-box {
  background: var(--paper-muted);
  border-style: dashed;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--paper-strong);
  border: 1px dashed var(--line-strong);
}

.compact-empty {
  padding: 0.85rem;
}

.empty-state strong {
  display: block;
  margin-bottom: 0.2rem;
}

.empty-graphic {
  position: relative;
  width: 5rem;
  height: 3.5rem;
}

.empty-graphic span {
  position: absolute;
  display: block;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(230, 200, 80, 0.30), rgba(240, 216, 112, 0.18));
}

.empty-graphic span:nth-child(1) {
  inset: 0.4rem auto auto 0;
  width: 2.3rem;
  height: 2.3rem;
  clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%);
}

.empty-graphic span:nth-child(2) {
  inset: 0 auto auto 2.2rem;
  width: 2.2rem;
  height: 1.9rem;
  clip-path: polygon(0 20%, 100% 0, 85% 100%, 8% 82%);
}

.empty-graphic span:nth-child(3) {
  inset: 1.45rem auto auto 1rem;
  width: 3rem;
  height: 1.55rem;
  clip-path: polygon(14% 0, 100% 18%, 82% 100%, 0 78%);
}

.status-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  background: var(--ink-faint);
  display: inline-block;
}

.status-dot.live {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(79, 141, 88, 0.5);
  animation: pulse 1.6s infinite;
}

.status-dot.offline {
  background: var(--danger);
}

.operator-feed {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 0.7rem;
  padding: 0.2rem 0.1rem 0.2rem 0;
  border-left: 1px solid var(--border);
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.operator-feed::-webkit-scrollbar {
  display: none;
}

.agent-feed::-webkit-scrollbar {
  display: block;
}

.anchor-stack {
  max-height: 360px;
  overflow: auto;
  padding-right: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 200, 80, 0.35) rgba(255, 255, 255, 0.04);
}

.anchor-stack::-webkit-scrollbar {
  width: 0.55rem;
}

.anchor-stack::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.anchor-stack::-webkit-scrollbar-thumb {
  background: rgba(230, 200, 80, 0.34);
  border-radius: 999px;
}

.anchor-card {
  gap: 0.55rem;
}

.operator-log-entry {
  margin-left: 1rem;
  padding-left: 1rem;
  position: relative;
}

.operator-log-entry::before {
  content: "";
  position: absolute;
  left: -0.31rem;
  top: 0.52rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--ink-faint);
}

.operator-log-entry-assistant::before {
  background: var(--accent);
}

.operator-log-entry-user::before {
  background: var(--accent-2);
}

.operator-log-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.operator-log-role {
  font-family: "Geist Mono", monospace;
  font-weight: 700;
  color: var(--ink-soft);
}

.operator-log-entry-assistant .operator-log-role {
  color: var(--accent);
}

.operator-log-entry-user .operator-log-role {
  color: var(--accent-2);
}

.operator-log-body {
  margin-top: 0.28rem;
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
}

.operator-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.operator-model-label {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.operator-model-select {
  width: auto;
  min-width: 10.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.85rem;
}

.operator-input-shell {
  position: relative;
  display: grid;
}

.operator-input-shell textarea {
  min-height: 7rem;
  padding: 0.95rem 3.2rem 1rem 1rem;
  border-radius: 1.1rem;
}

.operator-send-button {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  width: 2.2rem;
  height: 2.2rem;
  min-width: 2.2rem;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.operator-send-button img {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
  margin: 0 auto;
  filter: invert(78%) sepia(32%) saturate(531%) hue-rotate(4deg) brightness(95%) contrast(92%);
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.operator-form {
  gap: 0.7rem;
}

.operator-form button[disabled] {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-layout {
  width: min(100%, 32rem);
}

.auth-card {
  max-width: none;
}

.auth-card h1 {
  margin-top: 0;
}

.project-list,
.project-grid,
.project-layout,
.two-col,
.dashboard-grid,
.metrics {
  gap: var(--gutter);
}

.operator-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 10, 10, 0.56);
  backdrop-filter: blur(4px);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(122, 182, 72, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(122, 182, 72, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(122, 182, 72, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1400px) {
  .app-chrome {
    grid-template-columns: 96px minmax(0, 1fr) minmax(320px, 28vw);
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .app-chrome {
    grid-template-columns: 96px minmax(0, 1fr);
  }

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

@media (max-width: 1024px) {
  .bento-span-8,
  .bento-span-7,
  .bento-span-6,
  .bento-span-5,
  .bento-span-4,
  .bento-span-3 {
    grid-column: span 12;
  }

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

  .inline-form button {
    grid-column: 1 / -1;
  }
}

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

  .nav-rail {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .rail-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(92px, 1fr);
    overflow-x: auto;
    width: 100%;
  }

  .workspace {
    padding-top: 0.75rem;
  }

  .workspace-bar {
    flex-direction: column;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 0.75rem;
  }

  .workspace-bar,
  .card {
    padding: 0.95rem;
  }

  .stats-grid,
  .list-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .action-row,
  .table-action-cell {
    align-items: flex-start;
    flex-direction: column;
  }

  .rail-nav {
    grid-auto-columns: minmax(88px, 1fr);
  }
}

/* ── IDE Shell ─────────────────────────────────────────── */
.ide-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.ide-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Tab Bar ────────────────────────────────────────────── */
.ide-tab-bar {
  display: flex;
  align-items: center;
  background: #161616;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  gap: 0;
  flex-shrink: 0;
  height: 38px;
}

.ide-tab {
  padding: 0 16px;
  height: 38px;
  display: flex;
  align-items: center;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 180ms, border-color 180ms;
  text-decoration: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.ide-tab:hover { color: var(--ink-soft); text-decoration: none; }
.ide-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.ide-tab-spacer { flex: 1; }

.ide-tab-meta {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Tab Panels ─────────────────────────────────────────── */
.ide-panel {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.ide-panel.is-active { display: flex; }

/* ── Bottom Tray ────────────────────────────────────────── */
.bottom-tray {
  height: 26px;
  background: #0f0f0f;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 20px;
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.bottom-tray-item { display: flex; align-items: center; gap: 5px; }
.bottom-tray-item .tray-label { color: var(--ink-faint); }
.bottom-tray-item .tray-value { color: var(--ink); }
.bottom-tray-item .tray-value.good { color: var(--success); }
.bottom-tray-item .tray-value.warn { color: var(--warn); }
.bottom-tray-item .tray-value.bad { color: var(--danger); }

/* ── Chat Panel ─────────────────────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.chat-header {
  background: #161616;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
}

.chat-thread-name {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

.chat-thread-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
}

.chat-model-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--ink-soft);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
}

.chat-new-thread-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(230,200,80,0.1);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-msg-row {
  display: flex;
  padding: 4px 1.25rem;
}
.chat-msg-row.user { justify-content: flex-end; }
.chat-msg-row.assistant { justify-content: flex-start; }
.chat-msg-row.system { justify-content: center; }

.chat-bubble {
  max-width: 72%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble.user {
  background: rgba(230,200,80,0.12);
  border: 1px solid rgba(230,200,80,0.2);
  color: var(--ink);
  border-bottom-right-radius: 3px;
}

.chat-bubble.assistant {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  color: var(--ink);
  border-bottom-left-radius: 3px;
}

.chat-bubble.system {
  background: rgba(230,168,48,0.08);
  border: 1px solid rgba(230,168,48,0.15);
  color: var(--ink-soft);
  font-size: 11px;
  border-radius: 4px;
  max-width: 90%;
  font-family: "Geist Mono", monospace;
}

.chat-bubble pre {
  background: var(--paper-bg);
  border: 1px solid rgba(230,200,80,0.1);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 8px 0 0;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--success);
  overflow-x: auto;
  position: relative;
}

.chat-bubble code {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.06);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--success);
}

.chat-bubble pre code {
  background: none;
  padding: 0;
}

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── Chat Input ─────────────────────────────────────────── */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 10px 1.25rem 12px;
  background: var(--paper-bg);
  flex-shrink: 0;
}

.chat-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(230,200,80,0.18);
  border-radius: 10px;
  padding: 8px 10px;
  transition: border-color 180ms;
}

.chat-input-box:focus-within {
  border-color: rgba(230,200,80,0.38);
}

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
  resize: none;
  line-height: 1.5;
  min-height: 22px;
  max-height: 120px;
  overflow-y: auto;
}

.chat-textarea::placeholder { color: var(--ink-faint); }

.chat-send-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--accent);
  border: none;
  color: #0d0d0d;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 180ms, transform 180ms;
}
.chat-send-btn:hover { background: var(--accent-2); transform: none; }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.chat-input-hint {
  margin-top: 5px;
  font-family: "Geist Mono", monospace;
  font-size: 9px;
  color: #3a3028;
  display: flex;
  gap: 12px;
}
.chat-input-hint kbd {
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  padding: 0 3px;
  font-family: inherit;
  color: #5a5040;
}

/* ── Agent Feed ─────────────────────────────────────────── */
.agent-feed {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: none;
}

.agent-msg {
  display: flex;
  gap: 10px;
  padding: 5px 1.25rem;
  transition: background 120ms;
}
.agent-msg:hover { background: rgba(255,255,255,0.02); }

.agent-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Geist Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  color: #0d0d0d;
  margin-top: 1px;
}

.agent-msg-body { flex: 1; min-width: 0; }

.agent-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.agent-msg-name {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  font-weight: 700;
}

.agent-msg-time {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--ink-faint);
}

.agent-msg-project {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--ink-faint);
}

.agent-msg-project a { color: var(--ink-faint); }
.agent-msg-project a:hover { color: var(--accent); }

.agent-msg-text {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
  word-break: break-word;
}

.agent-feed-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--ink-faint);
}

.feed-stream {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

/* Avatar palette — derived from project/agent name via data-agent */
.agent-avatar[data-agent] { background: var(--ink-faint); color: var(--paper-bg); }
.agent-avatar[data-agent*="aphelion"] { background: #5b6ee1; color: #fff; }
.agent-avatar[data-agent*="prm"] { background: #e6c850; color: #0d0d0d; }
.agent-avatar[data-agent*="signal"] { background: #7ab648; color: #fff; }
.agent-avatar[data-agent*="discord"] { background: #7289da; color: #fff; }
.agent-avatar[data-agent*="auto"] { background: #e05c5c; color: #fff; }
.agent-avatar[data-agent*="engine"] { background: #e08c5c; color: #fff; }

/* ── Projects Drawer ────────────────────────────────────── */
.project-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: none;
}
.project-drawer-backdrop.is-open { display: block; }

.project-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: #111;
  border-right: 1px solid var(--line-strong);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 220ms ease;
}
.project-drawer.is-open { transform: translateX(0); }

.project-drawer-head {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.project-drawer-close {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 150ms;
}
.project-drawer-close:hover { color: var(--ink); transform: none; }
.chat-new-thread-btn:hover { background: rgba(230,200,80,0.2); transform: none; }

.project-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.project-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  transition: background 120ms;
}
.project-row:hover { background: rgba(255,255,255,0.04); }

.project-star-btn {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  color: #3a3028;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 150ms, transform 120ms;
}
.project-star-btn.is-starred { color: var(--accent); }
.project-star-btn:hover { transform: scale(1.2); }

.project-row-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 120ms;
}
.project-row-name:hover { color: var(--ink); text-decoration: none; }

.project-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.project-status-dot.active { background: var(--success); }
.project-status-dot.paused,
.project-status-dot.scoping,
.project-status-dot.idea { background: var(--warn); }
.project-status-dot.blocked { background: var(--danger); }
.project-status-dot.done { background: var(--ink-faint); }

/* ── Data Tables (operator page) ───────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Geist Mono", monospace;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.data-table tr.is-active td { color: var(--ink); background: rgba(230,200,80,0.06); }
.data-table tr.is-active td:first-child { color: var(--accent); }

.data-table a { color: var(--ink-soft); }
.data-table a:hover { color: var(--accent); text-decoration: none; }

/* ── Status chips ───────────────────────────────────────── */
.status-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.06);
  color: var(--ink-soft);
}
.status-chip.running   { background: rgba(122,182,72,0.15);  color: var(--success); }
.status-chip.completed { background: rgba(255,255,255,0.05); color: var(--ink-faint); }
.status-chip.failed    { background: rgba(224,92,92,0.15);   color: var(--danger); }
.status-chip.pending   { background: rgba(230,200,80,0.1);   color: var(--accent); }

/* ── Workspace sections ─────────────────────────────────── */
.workspace-section {
  margin-bottom: 32px;
}
.workspace-section .section-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}
