/* Lattice Lab — Anduril-inspired teaching UI */
:root {
  --bg: #050505;
  --bg-elev: #0c0c0c;
  --bg-card: #111111;
  --border: #222;
  --border-hi: #333;
  --text: #f2f2f2;
  --muted: #8a8a8a;
  --dim: #555;
  --accent: #dff140;
  --accent-dim: rgba(223, 241, 64, 0.15);
  --danger: #ff4d4d;
  --warn: #f5a623;
  --friend: #4ade80;
  --unknown: #fbbf24;
  --hostile: #f87171;
  --geo: #60a5fa;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0.03;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    #fff 2px,
    #fff 3px
  );
}

/* ── top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.65rem 1.25rem;
  background: rgba(5, 5, 5, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 180px; }
.mark {
  width: 28px; height: 28px;
  border: 2px solid var(--accent);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  background: linear-gradient(180deg, var(--accent-dim), transparent);
}
.brand-title {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
}
.brand-title .dim { color: var(--muted); font-weight: 500; }
.brand-sub { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.02em; }

.tabs { display: flex; gap: 0.15rem; flex: 1; flex-wrap: wrap; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.15s ease;
}
.tab:hover { color: var(--text); border-color: var(--border); }
.tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.top-stats { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.pill {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-elev);
}
.pill .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 0.2rem;
  vertical-align: middle;
}
.dot.live { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.mono { font-family: var(--mono); font-size: 0.72rem; }

/* ── layout ── */
main { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.panel { display: none; animation: fade 0.25s ease; }
.panel.active { display: block; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0 0 0.25rem; font-size: 1.5rem; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.muted.small, .small { font-size: 0.85rem; }
.dim { color: var(--dim); }
.accent { color: var(--accent); }
.mt { margin-top: 0.85rem; }
.block { display: block; }
.row { display: flex; align-items: center; }
.gap { gap: 0.5rem; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 1rem; }

/* ── hero ── */
.hero { margin-bottom: 2rem; max-width: 720px; }
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  font-weight: 700;
}
.lede { color: var(--muted); font-size: 1.05rem; margin: 0 0 1.25rem; }
.lede strong { color: var(--text); }
.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ── cards / grids ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.15rem 1.25rem;
}
.card.wide { grid-column: 1 / -1; }
.card-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.card p { margin: 0 0 0.75rem; color: var(--muted); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.grid-3.tight { margin: 0; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 900px) {
  .grid-3, .grid-2, .split, .cop-layout { grid-template-columns: 1fr !important; }
}

/* ── buttons ── */
.btn {
  appearance: none;
  border: 1px solid var(--border-hi);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.12s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn:hover { border-color: var(--muted); }
.btn.primary {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.small { font-size: 0.78rem; padding: 0.35rem 0.65rem; }
.linkish {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { text-decoration: underline; }

/* ── arch diagram ── */
.arch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.arch-node {
  border: 1px solid var(--border-hi);
  background: var(--bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  text-align: center;
  min-width: 120px;
}
.arch-node.mesh {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.arch-node small { color: var(--muted); display: block; font-size: 0.72rem; margin-top: 0.2rem; }
.arch-arrow {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bullets { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.bullets li { margin-bottom: 0.35rem; }
.bullets strong { color: var(--text); }
.bullets.compact li { margin-bottom: 0.25rem; font-size: 0.9rem; }

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.8rem;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; color: var(--accent); }

.path { margin: 0; padding-left: 1.25rem; color: var(--muted); }
.path li { margin-bottom: 0.5rem; }
.path button {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
}

/* ── forms ── */
label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.15rem; }
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  margin-top: 0.2rem;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.input.code, textarea.input {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  resize: vertical;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.chk { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }

/* ── code / out ── */
.out, .code-block {
  background: #080808;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  overflow: auto;
  color: #c8c8c8;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.out.tall, .code-block.tall { min-height: 280px; max-height: 480px; }
.code-block code { font: inherit; color: inherit; }

/* ── COP ── */
.cop-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
}
.cop-stage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
#cop-canvas {
  width: 100%;
  height: auto;
  display: block;
  background:
    radial-gradient(ellipse at 50% 50%, #0a1210 0%, #050505 70%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, #121212 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, #121212 40px);
  cursor: crosshair;
}
.cop-legend {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}
.swatch {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: middle;
}
.swatch.asset { background: var(--accent); }
.swatch.track { background: var(--unknown); border-radius: 0; transform: rotate(45deg); }
.swatch.geo { background: transparent; border: 1.5px solid var(--geo); }
.swatch.friend { background: var(--friend); }
.swatch.unknown { background: var(--warn); }
.swatch.media {
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 0 1px #111 inset;
  position: relative;
}
.swatch.media::after {
  content: "M";
  font-size: 7px;
  font-weight: 700;
  color: #111;
  position: absolute;
  left: 1px;
  top: -1px;
  line-height: 8px;
}
.swatch.pulse {
  background: transparent;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: cop-pulse-dot 1s ease infinite;
}
@keyframes cop-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.25); }
}

/* COP toast + media rail */
.cop-stage { position: relative; }
.cop-toast {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: min(520px, 92%);
  padding: 0.45rem 0.85rem;
  background: rgba(8, 8, 6, 0.92);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--text);
  box-shadow: 0 0 20px rgba(223, 241, 64, 0.12);
  pointer-events: none;
  animation: toast-in 0.2s ease;
}
.cop-toast[data-kind="delete"] { border-color: var(--danger); }
.cop-toast[data-kind="upload"] { border-color: var(--geo); }
.cop-toast[data-kind="link"] { border-color: var(--accent); }
.cop-toast .mono { color: var(--accent); font-size: 0.72rem; }
.cop-toast[data-kind="delete"] .mono { color: #fca5a5; }
.cop-toast[data-kind="upload"] .mono { color: #93c5fd; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.cop-media-rail {
  border-top: 1px solid var(--border);
  padding: 0.45rem 0.65rem 0.55rem;
  background: #080808;
}
.cmr-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin-bottom: 0.35rem;
}
.cmr-items {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}
.cmr-empty {
  font-size: 0.72rem;
  color: var(--dim);
  padding: 0.35rem 0;
}
.cmr-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  max-width: 200px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cmr-card:hover { border-color: var(--border-hi); }
.cmr-card.hot {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(223, 241, 64, 0.2);
}
.cmr-card img {
  width: 40px;
  height: 28px;
  object-fit: cover;
  background: #111;
  border: 1px solid var(--border);
  border-radius: 2px;
}
.cmr-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}
.cmr-meta strong {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmr-meta .mono {
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-list li.has-media { border-left: 2px solid var(--accent); }
.entity-list li.flash {
  animation: row-flash 0.8s ease 2;
}
@keyframes row-flash {
  0%, 100% { background: transparent; }
  50% { background: var(--accent-dim); }
}
.media-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 0.58rem;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--accent);
  color: #111;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.el-name { display: inline-flex; align-items: center; min-width: 0; }

.event-hint { margin: 0 0 0.25rem; font-size: 0.68rem; }
.event-feed li.clickable { cursor: pointer; }
.event-feed li.clickable:hover { color: var(--text); background: #12120a; }
.event-feed li.ev-object .kind { color: #93c5fd; }
.event-feed li.ev-task .kind { color: #fbbf24; }
.event-feed li.ev-entity .kind { color: var(--accent); }

.entity-detail { max-height: 280px; }
.ed-media {
  margin: 0.5rem 0;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0a0a0a;
}
.ed-media.empty {
  border-style: dashed;
  padding: 0.35rem 0.5rem;
}
.ed-media-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.ed-media-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ed-thumb {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.45rem;
  text-align: left;
  background: #080808;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.ed-thumb:hover { border-color: var(--accent); }
.ed-thumb img {
  grid-row: 1 / 3;
  width: 48px;
  height: 36px;
  object-fit: cover;
  background: #111;
  border: 1px solid var(--border);
}
.ed-thumb .mono {
  font-size: 0.65rem;
  color: var(--muted);
  word-break: break-all;
}
.ed-thumb .tag {
  font-size: 0.6rem;
  color: var(--dim);
}

.cop-side {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  max-height: 640px;
}
.cop-side h3 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.entity-list, .event-feed, .task-list, .obj-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
  min-height: 80px;
}
.entity-list { max-height: 200px; margin-bottom: 0.75rem; }
.entity-list li, .task-list li, .obj-list li {
  padding: 0.45rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.entity-list li:hover, .task-list li:hover, .obj-list li:hover {
  background: var(--bg);
  border-color: var(--border);
}
.entity-list li.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.entity-list .tag, .task-list .tag {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: uppercase;
}
.entity-detail {
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
  font-size: 0.8rem;
  max-height: 160px;
  overflow: auto;
}
.entity-detail pre {
  margin: 0.35rem 0 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  white-space: pre-wrap;
}
.event-feed { max-height: 140px; border-top: 1px solid var(--border); padding-top: 0.4rem; }
.event-feed li {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  padding: 0.2rem 0;
  border-bottom: 1px solid #161616;
}
.event-feed .kind { color: var(--accent); }

/* ── task lifecycle ── */
.lifecycle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.lc-step {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-family: var(--mono);
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--muted);
}
.lc-step.hot {
  border-color: var(--accent);
  color: var(--bg);
  background: var(--accent);
  font-weight: 700;
}
.lc-arrow, .lc-or { color: var(--dim); font-size: 0.75rem; }

.task-list { max-height: 220px; margin-top: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.task-list li { border-bottom: 1px solid #161616; }
.status-badge {
  font-size: 0.65rem;
  font-family: var(--mono);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #1a1a1a;
  color: var(--warn);
}
.status-badge.ok { color: var(--friend); }
.status-badge.exec { color: var(--accent); }

.mini {
  display: block;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  background: var(--bg);
  transition: 0.12s ease;
}
.mini:hover { border-color: var(--accent); color: var(--accent); }

.foot {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 1280px;
  margin: 0 auto;
}
.foot strong { color: var(--text); }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: #1a1a1a;
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
a { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   OBJECT STORE · dual pane (GUI + CLI)
   ═══════════════════════════════════════════════════════════ */
.obj-schema-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}
.osb-item {
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
}
.osb-item strong {
  color: var(--accent);
  font-weight: 600;
  margin-right: 0.25rem;
}

.obj-dual {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 0.85rem;
  min-height: 640px;
  align-items: stretch;
}
@media (max-width: 1100px) {
  .obj-dual { grid-template-columns: 1fr; }
}

.card-flat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.obj-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #12120c 0%, #0c0c0c 100%);
}
.oph-left { display: flex; align-items: center; gap: 0.6rem; }
.oph-mark {
  width: 18px; height: 18px;
  border: 1.5px solid var(--accent);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  background: var(--accent-dim);
}
.oph-title {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  font-weight: 700;
}
.oph-sub { font-size: 0.68rem; color: var(--muted); }
.oph-stats { font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }

.oph-cli-dots { display: flex; gap: 5px; }
.oph-cli-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: #333; display: block;
}
.oph-cli-dots i:nth-child(1) { background: #ff5f57; }
.oph-cli-dots i:nth-child(2) { background: #febc2e; }
.oph-cli-dots i:nth-child(3) { background: #28c840; }

.cli-head { background: #0a0a0a; }

.obj-gui-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: 520px;
}
@media (max-width: 700px) {
  .obj-gui-body { grid-template-columns: 1fr; }
}

.obj-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0a0a0a;
}
.obj-toolbar {
  display: flex;
  gap: 0.35rem;
  padding: 0.55rem;
  border-bottom: 1px solid var(--border);
}
.obj-tree {
  flex: 1;
  overflow: auto;
  min-height: 160px;
  max-height: 280px;
  padding: 0.35rem;
}
.obj-empty {
  padding: 1rem;
  color: var(--dim);
  font-size: 0.8rem;
  text-align: center;
}
.obj-folder {
  padding: 0.35rem 0.45rem 0.15rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.of-name { color: var(--muted); }
.obj-row {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  padding: 0.4rem 0.45rem;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 2px;
}
.obj-row:hover { background: #111; border-color: var(--border); }
.obj-row.active {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.obj-ico {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 3px;
  background: #222;
  border: 1px solid #333;
  position: relative;
}
.obj-ico::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 1px;
  background: var(--muted);
  opacity: 0.5;
}
.obj-ico.img { border-color: #60a5fa; }
.obj-ico.img::after { background: #60a5fa; opacity: 0.7; }
.obj-ico.json { border-color: var(--accent); }
.obj-ico.json::after { background: var(--accent); opacity: 0.6; }
.obj-ico.csv { border-color: #4ade80; }
.obj-ico.csv::after { background: #4ade80; opacity: 0.55; }
.obj-ico.txt { border-color: #94a3b8; }
.obj-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.obj-row-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-row-path { font-size: 0.62rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.obj-size { font-size: 0.62rem; font-family: var(--mono); color: var(--muted); }
.obj-node {
  font-size: 0.58rem;
  font-family: var(--mono);
  color: #f5a623;
  border: 1px solid #3a2a10;
  padding: 0 0.25rem;
  border-radius: 2px;
}
.obj-link-badge {
  font-size: 0.58rem;
  color: var(--accent);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.obj-upload-box {
  border-top: 1px solid var(--border);
  padding: 0.65rem;
  overflow: auto;
  max-height: 340px;
}
.btn.full { width: 100%; justify-content: center; }

.obj-main {
  padding: 0.85rem;
  overflow: auto;
  min-height: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(223, 241, 64, 0.04), transparent 50%),
    var(--bg-card);
}
.obj-detail-empty {
  height: 100%;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  gap: 0.35rem;
}
.ode-icon {
  width: 48px; height: 48px;
  border: 2px solid var(--border-hi);
  margin-bottom: 0.5rem;
  position: relative;
  background: #0a0a0a;
}
.ode-icon::before {
  content: "";
  position: absolute;
  left: 8px; right: 8px; top: 14px; height: 2px;
  background: var(--accent);
  opacity: 0.5;
  box-shadow: 0 8px 0 var(--border-hi), 0 16px 0 var(--border-hi);
}
.hidden { display: none !important; }

.obj-detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.od-path { font-size: 1rem; font-weight: 600; color: var(--accent); word-break: break-all; }
.od-api { font-size: 0.72rem; margin-top: 0.15rem; }

.obj-meta-grid {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 0.3rem 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #080808;
  margin-bottom: 0.85rem;
  font-size: 0.75rem;
}
.omg-k { color: var(--muted); font-family: var(--mono); font-size: 0.68rem; }
.omg-v { color: var(--text); word-break: break-all; font-size: 0.72rem; }

.obj-preview-wrap { margin-bottom: 0.85rem; }
.obj-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #050505;
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
  padding: 0.65rem;
}
.od-img {
  max-width: 100%;
  max-height: 240px;
  display: block;
  margin: 0 auto;
  background: #111;
  border: 1px solid var(--border);
}
.od-text, .od-hex {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  color: #c8c8c8;
  white-space: pre-wrap;
  word-break: break-word;
}
.od-hex { color: #8ab4f8; white-space: pre; }
.err { color: var(--danger); font-size: 0.85rem; }

.obj-link-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: #0a0a0a;
}
.danger-btn { color: #fca5a5 !important; border-color: #4a2020 !important; }
.danger-btn:hover { border-color: var(--danger) !important; }

/* CLI terminal */
.obj-cli { background: #050505; }
.cli-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: 640px;
  padding: 0.65rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  background:
    linear-gradient(rgba(223, 241, 64, 0.02) 1px, transparent 1px),
    #050505;
  background-size: 100% 4px;
  outline: none;
}
.cli-output {
  flex: 1;
  overflow: auto;
  color: #c8c8c8;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.cli-block { margin-bottom: 0.55rem; }
.cli-echo { color: #e8e8e8; }
.cli-prompt {
  color: var(--accent);
  font-weight: 600;
  margin-right: 0.4rem;
  user-select: none;
}
.cli-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid #151515;
  margin-top: 0.25rem;
}
.cli-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  outline: none;
  caret-color: var(--accent);
  min-width: 0;
}
.cli-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.45rem 0.65rem;
  border-top: 1px solid var(--border);
  background: #0a0a0a;
}
.cli-hints button {
  font-family: var(--mono);
  font-size: 0.65rem;
  background: #111;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  cursor: pointer;
}
.cli-hints button:hover {
  color: var(--accent);
  border-color: #3a3a20;
}

.obj-activity { max-height: 180px; overflow: hidden; }
.obj-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 120px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.obj-activity-list li {
  display: flex;
  gap: 0.65rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid #161616;
  color: var(--muted);
}
.oa-kind { color: var(--accent); min-width: 120px; }
.oa-detail { flex: 1; word-break: break-all; }
.oa-time { color: var(--dim); }
