/* Kinetigor IDE Shell — Cursor / VS Code layout, maximum editor space */

.kd-ide { --ide-bg: #06060e; --ide-sidebar: #0a0a14; --ide-panel: #0e0e1a; --ide-border: rgba(255,255,255,0.08); --ide-titlebar: 35px; --ide-statusbar: 22px; --ide-term: 260px; --ide-sidebar-w: 240px; --ide-agent-w: 340px; --ide-activity: 48px; }

.kd-ide-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ide-bg);
  overflow: hidden;
}

/* ── Title bar ── */
.kd-titlebar {
  height: var(--ide-titlebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: #0c0c16;
  border-bottom: 1px solid var(--ide-border);
  flex-shrink: 0;
  font-size: 12px;
}
.kd-titlebar-left, .kd-titlebar-right { display: flex; align-items: center; gap: 8px; }
.kd-app-icon { border-radius: 4px; }
.kd-app-name { font-weight: 600; color: var(--ink); letter-spacing: 0.02em; }
.kd-app-sep { color: var(--muted); opacity: 0.5; }
.kd-app-workspace { color: var(--muted); font-size: 11px; }
.kd-shell-badge {
  font: 600 10px ui-monospace, monospace;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(123, 211, 137, 0.12);
  color: #7bd389;
  border: 1px solid rgba(123, 211, 137, 0.25);
}
.kd-tb-btn {
  font: 600 10px Inter;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--ide-border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.kd-tb-btn:hover { color: var(--gold-bright); border-color: rgba(212,175,55,0.4); }
.kd-theme-mini { max-width: 140px; }
.kd-theme-mini .theme-chip { font-size: 11px; padding: 2px 5px; }

/* ── Workbench: 3 columns ── */
.kd-workbench {
  flex: 1;
  display: grid;
  grid-template-columns: calc(var(--ide-activity) + var(--ide-sidebar-w)) 1fr var(--ide-agent-w);
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .kd-workbench { grid-template-columns: calc(var(--ide-activity) + 180px) 1fr 280px; }
}

/* COL 1: Activity + Sidebar */
.kd-col-left {
  display: flex;
  min-height: 0;
  border-right: 1px solid var(--ide-border);
  background: var(--ide-sidebar);
}
.kd-activity-bar {
  width: var(--ide-activity);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  background: #080810;
  border-right: 1px solid var(--ide-border);
  flex-shrink: 0;
}
.kd-act {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: all 0.12s;
}
.kd-act:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
.kd-act.on { color: var(--gold-bright); border-left: 2px solid var(--gold); background: rgba(212,175,55,0.08); }

.kd-sidebar {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  min-width: 0;
}
.kd-sidebar-hdr {
  font: 700 9px Cinzel, serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.kd-sidebar-section { display: none; }
.kd-sidebar-section.on { display: block; }
.kd-pipeline-compact .pipe-step { padding: 6px 8px; min-width: 0; }
.kd-pipeline-compact { display: flex; flex-direction: column; gap: 4px; }
.kd-loop-compact { flex-wrap: wrap; }
.kd-loop-detail { font-size: 10px; color: var(--muted); margin-top: 6px; }
.kd-monk-compact .monk-row { padding: 6px 8px; font-size: 10px; }
.kd-sidebar-more { margin-top: 12px; font-size: 10px; color: var(--muted); }
.kd-sidebar-more summary { cursor: pointer; padding: 4px 0; }
.kd-offer-row { flex-direction: column; gap: 4px; }
.kd-offer-row input { width: 100%; margin: 0; font-size: 10px; }

/* COL 2: Editor */
.kd-col-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--ide-bg);
}
.kd-tab-bar {
  display: flex;
  height: 35px;
  background: #0a0a12;
  border-bottom: 1px solid var(--ide-border);
  flex-shrink: 0;
  overflow-x: auto;
}
.kd-tab {
  font: 500 11px Inter;
  padding: 0 16px;
  border: none;
  border-right: 1px solid var(--ide-border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kd-tab:hover { color: var(--ink); background: rgba(255,255,255,0.03); }
.kd-tab.on {
  color: var(--ink);
  background: var(--ide-bg);
  border-top: 2px solid var(--gold);
  margin-top: -1px;
}

.kd-editor-views { flex: 1; min-height: 0; position: relative; }
.kd-editor-view {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 0;
}
.kd-editor-view.on { display: flex; flex-direction: column; }

/* North Star hero — full editor canvas */
.kd-northstar-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(123, 211, 137, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 70% 60%, rgba(110, 200, 255, 0.06), transparent),
    linear-gradient(180deg, #06060e 0%, #0a0a18 100%);
  min-height: 280px;
}
.kd-northstar-hero .hero-owl {
  width: min(200px, 40vw);
  height: min(200px, 40vw);
  filter: drop-shadow(0 0 40px rgba(212, 175, 55, 0.35)) drop-shadow(0 0 80px rgba(110, 200, 255, 0.2));
  margin-bottom: 20px;
}
.kd-northstar-hero h1 {
  margin: 0 0 8px;
  font: 700 1.4rem/1.2 Cinzel, serif;
  letter-spacing: 0.12em;
  color: var(--gold-bright);
  text-transform: uppercase;
}
.kd-northstar-hero .sub { font-size: 13px; color: var(--cyan); margin: 0 0 12px; }
.kd-northstar-hero .vision-head { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 6px; max-width: 520px; }
.kd-northstar-hero .vision-sub { font-size: 12px; color: var(--muted); margin: 0; max-width: 480px; line-height: 1.5; }
.kd-stats-inline {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--ide-border);
  flex-shrink: 0;
}

.kd-code-editor { padding: 16px; height: 100%; overflow-y: auto; }
.kd-replay-full { border: none; background: transparent; padding: 16px; height: 100%; }
.kd-replay-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.kd-replay-toolbar h2 { margin: 0; font-size: 0.75rem; }

.kd-statusbar {
  height: var(--ide-statusbar);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #007acc;
  color: #fff;
  font: 500 11px Inter;
  flex-shrink: 0;
}
.kd-status-sep { opacity: 0.5; }
.kd-status-spacer { flex: 1; }
.kd-status-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  opacity: 0.85;
}

/* COL 3: Agent panel */
.kd-col-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--ide-border);
  background: var(--ide-panel);
}
.kd-agent-header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ide-border);
  flex-shrink: 0;
}
.kd-agent-face {
  width: 48px !important;
  height: 48px !important;
  max-height: 48px !important;
  aspect-ratio: 1;
  flex-shrink: 0;
}
.kd-agent-title { font: 600 13px Inter; color: var(--ink); }
.kd-agent-sub { font-size: 10px; color: var(--muted); }
.kd-nemeton-mini { height: 48px; margin: 0 12px; flex-shrink: 0; }
.kd-nemeton-legend { font-size: 9px; padding: 0 12px 6px; margin: 0; }
.kd-agent-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 12px 12px;
}
.kd-agent-chat .chat-feed { flex: 1; max-height: none; min-height: 0; }
.kd-agent-chat .panel-chat { min-height: 0; }

/* Terminal — bottom panel */
.kd-ide .kd-terminal-wrap {
  height: var(--ide-term);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--ide-border);
}
.kd-ide .kd-terminal-wrap.maximized {
  position: fixed;
  inset: var(--ide-titlebar) 0 0 0;
  height: auto;
  z-index: 200;
}
.kd-term-tabs { display: flex; gap: 0; }
.kd-term-tab {
  font: 600 10px Inter;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  color: var(--muted);
  border-right: 1px solid var(--ide-border);
}
.kd-term-tab.on { color: var(--ink); background: rgba(255,255,255,0.04); }
.kd-ide .kinetigor-terminal-panel.hud-bridge-terminal {
  max-height: none !important;
  flex: 1;
  min-height: 0;
}
.kd-ide .kd-terminal-header {
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  min-height: 32px;
}

/* Hide old clutter elements if any leak through */
.kd-ide .hero-band:not(.kd-northstar-hero) { display: none; }

.kd-workbench-integrated {
  grid-template-columns: var(--ide-activity) 1fr 260px;
}
.kd-buddy-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--ide-bg);
}
.kd-warroom-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #06060f;
}
.kd-tab-bob.on {
  border-top-color: var(--gold-bright, #ffd93b);
  color: var(--gold-bright, #ffd93b);
}
.kd-col-desk { min-width: 0; }
.kd-col-agent { border-left: 1px solid var(--ide-border); overflow-y: auto; }
.kd-northstar-side { padding: 12px; text-align: center; }
.kd-northstar-side .hero-owl {
  width: 72px; height: 72px;
  filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.35));
  margin-bottom: 8px;
}
.kd-northstar-side .vision-head { font-size: 11px; font-weight: 600; margin: 0 0 4px; }
.kd-northstar-side .vision-sub { font-size: 10px; color: var(--muted); margin: 0; line-height: 1.4; }
.kd-stats-side { flex-wrap: wrap; padding: 8px 12px; gap: 4px; }
.kd-stats-side .pill { font-size: 9px; padding: 3px 6px; }
.kd-comms-side { max-height: 120px; overflow-y: auto; padding: 0 12px 12px; font-size: 9px; }
.kd-hidden { display: none !important; }
.kd-theme-count { font-size: 10px; color: var(--muted); margin-left: 8px; }

/* Lens art + crew panel (15 lenses) */
.kd-ide[data-theme="nemeton"] { --accent: #7bd389; --accent-glow: rgba(123, 211, 137, 0.35); --panel-tint: rgba(123, 211, 137, 0.08); }
.kd-ide[data-theme="mission_control"] { --accent: #38e0ff; --accent-glow: rgba(56, 224, 255, 0.35); --panel-tint: rgba(56, 224, 255, 0.08); }
.kd-ide[data-theme="xo_bridge"] { --accent: #d4af37; --accent-glow: rgba(212, 175, 55, 0.35); --panel-tint: rgba(212, 175, 55, 0.08); }
.kd-ide[data-theme="chief_of_staff"] { --accent: #c9b896; --accent-glow: rgba(201, 184, 150, 0.35); }
.kd-ide[data-theme="kitchen"] { --accent: #ffb347; --accent-glow: rgba(255, 179, 71, 0.35); }
.kd-ide[data-theme="orchestra"] { --accent: #c9a0ff; --accent-glow: rgba(201, 160, 255, 0.35); }
.kd-ide[data-theme="watch_log"] { --accent: #8eb4c9; --accent-glow: rgba(142, 180, 201, 0.35); }
.kd-ide[data-theme="academy"] { --accent: #9fd356; --accent-glow: rgba(159, 211, 86, 0.35); }
.kd-ide[data-theme="ctf_arena"] { --accent: #ff6b9d; --accent-glow: rgba(255, 107, 157, 0.35); }
.kd-ide[data-theme="research_lab"] { --accent: #6ec8ff; --accent-glow: rgba(110, 200, 255, 0.35); }
.kd-ide[data-theme="audit_command_center"] { --accent: #f4d35e; --accent-glow: rgba(244, 211, 94, 0.35); }
.kd-ide[data-theme="courtroom"] { --accent: #b8a9c9; --accent-glow: rgba(184, 169, 201, 0.35); }
.kd-ide[data-theme="newsroom"] { --accent: #e8c547; --accent-glow: rgba(232, 197, 71, 0.35); }
.kd-ide[data-theme="firehouse"] { --accent: #ff5c5c; --accent-glow: rgba(255, 92, 92, 0.35); }
.kd-ide[data-theme="lean_factory"] { --accent: #94a3b8; --accent-glow: rgba(148, 163, 184, 0.35); }

.theme-chip {
  border: 1px solid var(--ide-border);
  background: rgba(0,0,0,0.35);
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-chip.on { border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); transform: scale(1.08); }
.theme-chip.has-mark { padding: 2px; }
.lens-chip-mark { display: block; border-radius: 4px; }

.lens-hero-strip { padding: 0 12px 8px; }
.lens-hero-img {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 8px;
  margin: 0 auto;
}
.lens-hero-side { margin: 0 auto 8px; }

.kd-agent-header { display: flex; gap: 10px; align-items: center; padding: 12px; }
.kd-agent-mark { border-radius: 8px; box-shadow: 0 0 12px var(--accent-glow, rgba(123,211,137,0.3)); }

.lens-crew-map {
  margin: 0 12px 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--ide-border);
  background: linear-gradient(160deg, var(--panel-tint, rgba(123,211,137,0.08)), rgba(0,0,0,0.25));
}
.lens-crew-map h3 { margin: 0 0 4px; font: 600 10px Cinzel, serif; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.lens-crew-map .lens-pitch { margin: 0 0 8px; font-size: 10px; color: var(--muted); }
.lens-crew-grid { display: grid; grid-template-columns: 1fr; gap: 4px; }
.lens-crew-row { padding: 5px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.06); background: rgba(0,0,0,0.2); font-size: 10px; }
.lens-crew-row .role { font-weight: 700; color: var(--gold); font-size: 9px; text-transform: uppercase; }
.lens-crew-row .title { color: var(--ink); }

.kd-ide:not([data-theme="nemeton"]) #nemeton-viz,
.kd-ide:not([data-theme="nemeton"]) .kd-nemeton-legend { display: none; }
