:root {
  --bg: #0d1117;
  --bg-elevated: #141b25;
  --bg-card: #192230;
  --bg-subtle: #10161f;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.14);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --rose: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.14);
  --radius: 10px;
  --radius-sm: 6px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Top Navigation Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 54px;
  padding: 0 18px;
  background: rgba(13, 17, 23, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #0d1117;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-spec {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
  white-space: nowrap;
}

.tab-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

.tab-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.35);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.byok-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.byok-pill:hover {
  border-color: var(--cyan);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}

.status-dot.byok {
  background: var(--cyan);
}

.manifest-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.manifest-link:hover {
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.4);
}

/* Main Workspace Layout */
.workspace {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 18px 18px;
}

.tab-panel {
  display: grid;
  gap: 14px;
}

.grid-hub {
  grid-template-columns: 1.18fr 0.88fr;
  align-items: start;
}

.grid-trust {
  grid-template-columns: 1.08fr 0.92fr;
  align-items: start;
}

.grid-arcade {
  grid-template-columns: 1.08fr 0.92fr;
  align-items: start;
}

/* Panels & Cards */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.filter-bar select,
.filter-bar input[type="text"],
.field-input,
.field-select,
.field-textarea {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: var(--sans);
  font-size: 12px;
}

.field-textarea {
  width: 100%;
  resize: vertical;
  font-family: var(--mono);
  font-size: 11.5px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}

.btn:hover {
  border-color: var(--amber);
}

.btn-primary {
  background: var(--amber);
  color: #0d1117;
  border-color: var(--amber);
}

.btn-primary:hover {
  background: #fbbf24;
}

.btn-emerald {
  background: var(--emerald);
  color: #042117;
  border-color: var(--emerald);
}

.btn-danger {
  background: var(--rose-soft);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.45);
}

.btn-cyan {
  background: var(--cyan-soft);
  color: var(--cyan);
  border-color: rgba(56, 189, 248, 0.4);
}

.btn-xs {
  padding: 3px 7px;
  font-size: 11px;
}

/* Jam Grid */
.jam-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.jam-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jam-card.shortlisted {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.15);
}

.jam-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.jam-title {
  font-weight: 700;
  font-size: 13px;
}

.jam-org {
  font-size: 11px;
  color: var(--text-muted);
}

.jam-prize {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--emerald);
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.tag.no-ai {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.tag.disclosed-ai {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.ai-encouraged {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.tag.write-badge {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.irrev-badge {
  background: var(--rose-soft);
  color: #fda4af;
}

.tag.read-badge {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.jam-theme {
  font-size: 11.5px;
  color: var(--text-muted);
}

.jam-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

/* Open Asset Packs Strip */
.asset-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.asset-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
}

.asset-chip-name {
  font-weight: 600;
  font-size: 11.5px;
  margin-bottom: 3px;
}

.asset-chip-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Multi-Agent Concierge Panel */
.trace-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 7px;
  min-height: 36px;
}

.trace-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
}

.trace-pill.front {
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--amber);
}

.trace-pill.specialist {
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--cyan);
}

.trace-pill.action,
.trace-pill.peer {
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--emerald);
}

.trace-pill.blocked {
  border-color: rgba(244, 63, 94, 0.5);
  color: #fda4af;
}

.trace-arrow {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
}

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

.chip-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.chip-btn:hover {
  color: var(--text);
  border-color: var(--cyan);
}

.chat-log {
  height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.msg {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.msg h4 {
  margin: 6px 0 3px;
  font-size: 12.5px;
  color: var(--amber);
}

.msg h4:first-child {
  margin-top: 0;
}

.msg code {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan);
}

.msg p {
  margin: 0 0 5px;
}

.msg p:last-child {
  margin-bottom: 0;
}

.msg.user {
  align-self: flex-end;
  max-width: 88%;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.msg.assistant {
  align-self: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.msg-role {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.chat-form {
  display: flex;
  gap: 7px;
}

.chat-form input {
  flex: 1;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12.5px;
}

/* Tab 2: Peer Consent Card, sly_data Inspector & 12-Check Auditor */
.consent-card {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(25, 34, 48, 0.96));
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 9px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.consent-card.tamper {
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.14), rgba(25, 34, 48, 0.96));
  border-color: rgba(244, 63, 94, 0.7);
}

.kv-grid {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 4px 8px;
  font-size: 11.5px;
}

.kv-key {
  font-family: var(--mono);
  color: var(--text-muted);
}

.kv-val {
  font-family: var(--mono);
  color: var(--text);
  word-break: break-all;
}

.sly-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.code-box {
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 9px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
}

.code-box.blocked {
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

.code-box.allowed {
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 490px;
  overflow-y: auto;
}

.audit-row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.audit-id {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--cyan);
}

.audit-title {
  font-weight: 600;
  font-size: 11.5px;
}

.audit-detail {
  font-size: 10.5px;
  color: var(--text-muted);
}

.badge-pass {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald);
}

.badge-fail {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--rose-soft);
  color: #fda4af;
}

/* Tab 3: Arcade & WebMCP */
.hud-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.hud-stat {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  text-align: center;
}

.hud-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hud-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--amber);
}

.arcade-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #0b1018;
  cursor: crosshair;
}

.scoreboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border-radius: 5px;
}

.tool-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 410px;
  overflow-y: auto;
}

.tool-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tool-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--cyan);
}

.receipt-list {
  max-height: 115px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Overlays: BYOK Drawer & Confirmation Modal */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 8, 13, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.overlay.drawer-align {
  justify-content: flex-end;
  padding: 0;
}

.drawer-card {
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-strong);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.modal-card {
  width: min(480px, 95vw);
  background: var(--bg-elevated);
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 11px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.notice-box {
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: #a7f3d0;
}

@media (max-width: 1024px) {
  .grid-hub,
  .grid-trust,
  .grid-arcade,
  .jam-grid,
  .asset-strip,
  .sly-split {
    grid-template-columns: 1fr;
  }
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
  }
}
