/* ================================================================
   Kinhelm Studio — Stylesheet
   ================================================================
   Kinhelm brand palette (purple gradations):
     --irc-blue:   #4826FD  Kinhelm Blue        (primary CTA, links)
     --irc-teal:   #ffffff  Kinhelm White      (secondary, hover, success)
     --irc-amber:  #F5A623  Kinhelm Amber         (highlight, warnings)
     --irc-orange: #E8620A  Kinhelm Orange        (danger, error)
     --irc-dark:   #070513  Kinhelm Dark   (body text, navbar bg)
     --irc-purple-deep:    #24137F  (deep brand purple, alt surfaces)
     --irc-purple-hover:   #3511F5  (primary hover)
     --irc-purple-surface: #EDE9FF  (light purple surface)
   Font: Inter (fallback to system)
   ================================================================ */

/* ── CSS Custom Properties ──────────────────────────────────────── */
:root {
  /* Kinhelm brand exact values — purple palette */
  --irc-blue:           #E8620A;   /* Kinhelm primary */
  --irc-blue-hover:     #3511F5;   /* primary hover (deeper purple) */
  --irc-teal:           #ffffff;   /* secondary lavender */
  --irc-amber:          #F5A623;   /* warnings/highlights */
  --irc-orange:         #E8620A;   /* danger/error */
  --irc-dark:           #070513;   /* deep purple-black */
  --irc-purple-deep:    #24137F;   /* deep brand purple */
  --irc-purple-surface: #EDE9FF;   /* light purple surface */
  --irc-slate:          #9694B5;   /* muted lavender slate */
  --irc-gray-light:     #F5F5F5;
  --irc-gray:           #D9D9D6;

  /* Studio dark-shell palette */
  --shell:        #0d1117;
  --surface:      #161b22;
  --surface-2:    #1c2128;
  --surface-3:    #21262d;
  --border:       rgba(255,255,255,0.08);
  --border-strong:rgba(255,255,255,0.15);
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-subtle:  #6e7681;

  /* Layout */
  --navbar-h:      56px;
  --sidebar-w:     390px;
  --sidebar-min:   280px;
  --sidebar-max:   620px;
  --font-mono: 'JetBrains Mono','Fira Code','Consolas',monospace;
  --font-ui:   'Inter','Arial',sans-serif;
}

/* ── Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: 100%; margin: 0; padding: 0;
  font-family: var(--font-ui);
  background: var(--shell);
  color: var(--text);
  overflow: hidden;
}

/* ── Navbar ──────────────────────────────────────────────────────── */
.vibe-navbar {
  height: var(--navbar-h);
  background: var(--irc-dark);
  box-shadow: 0 3px 0 0 var(--irc-blue);  /* blue accent below navbar, outside the flow — no button clipping */
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center;
  overflow: visible;
}

.brand-logo-wrap {
  display: flex; align-items: center; gap: 0;
  text-decoration: none;
}
.brand-logo-img {
  height: 30px;
  width: auto;
  display: block;
}
.brand-divider {
  width: 1px; height: 26px;
  background: rgba(255,255,255,0.25);
  margin: 0 14px;
  flex-shrink: 0;
}
.brand-app-name {
  font-size: .82rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--irc-teal);
  white-space: nowrap;
}

.vibe-project-badge {
  font-size: .75rem; padding: 3px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
}
.github-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; color: var(--text-muted); text-decoration: none;
  padding: 2px 7px; border: 1px solid var(--border); border-radius: 3px;
  transition: color .2s, border-color .2s;
}
.github-chip:hover { color: var(--irc-teal); border-color: var(--irc-teal); }


/* ── Responsive Studio navbar / preview-toolbar overlap guard ───────────────
   At browser zoom 100% the project nav row can be wider than the viewport.
   Previously those controls wrapped/overflowed below the fixed navbar and
   visually covered the preview toolbar buttons (phone/tablet/desktop/open).
   Keep the nav as a single row, shrink long chips, and hide text labels before
   allowing overlap. */
.vibe-navbar {
  gap: 10px;
  /* Allow user-menu dropdown and nav popups to escape vertically.
     Horizontal control overflow is still managed by the inner .ms-auto group. */
  overflow: visible;
}
.vibe-navbar .brand-logo-wrap {
  flex: 0 1 auto;
  min-width: 180px;
  max-width: clamp(260px, 28vw, 560px);
  overflow: hidden;
}
.vibe-navbar > .ms-auto {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  flex-wrap: nowrap !important;
  justify-content: flex-end;
  /* `overflow-x: clip` + `overflow-y: visible` lets the user-menu dropdown
     escape downward while horizontal control overflow stays clipped/scrollable. */
  overflow-x: clip;
  overflow-y: visible;
  scrollbar-width: none;
  white-space: nowrap;
}
/* The wrapping .dropdown must also allow its popup to escape. */
.vibe-navbar .dropdown,
.vibe-navbar .dropdown .dropdown-menu {
  overflow: visible;
}
.vibe-navbar .dropdown-menu.show { z-index: 1500; }
.vibe-navbar > .ms-auto::-webkit-scrollbar { display: none; }
.vibe-navbar > .ms-auto > * { flex: 0 0 auto; }
.vibe-navbar .github-chip,
.vibe-navbar .vibe-project-badge {
  min-width: 0;
  max-width: min(260px, 18vw);
  overflow: hidden;
  text-overflow: ellipsis;
}
.vibe-navbar .github-chip span,
.vibe-navbar .vibe-project-badge {
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-header { position: relative; z-index: 1; }
.preview-header > .d-flex { flex: 0 0 auto; flex-wrap: nowrap; }
.preview-url-bar { min-width: 160px; }

@media (max-width: 1700px) {
  .vibe-navbar .github-chip { max-width: 210px; }
  .vibe-navbar .vibe-project-badge { max-width: 180px; }
  .secrets-nav-btn { padding-left: 8px; padding-right: 8px; }
}

@media (max-width: 1500px) {
  .vibe-navbar .github-chip { max-width: 165px; }
  .vibe-navbar .vibe-project-badge { max-width: 150px; }
  /* Icon-only controls at tighter widths. */
  #deployGuideToggle span,
  #debugPanelToggle span,
  #secretsDrawerToggle > span:not(.secrets-nav-badge),
  .vibe-navbar a[title="Admin Panel"] span,
  .vibe-navbar a[title="Getting Started & Overview"] span {
    display: none !important;
  }
}

@media (max-width: 1280px) {
  .brand-studio-logo { display: none !important; }
  .vibe-navbar .github-chip { max-width: 135px; }
  .vibe-navbar .vibe-project-badge { max-width: 120px; }
}

/* ── Studio split layout ─────────────────────────────────────────── */
.studio-layout {
  display: flex;
  position: fixed;
  top: var(--navbar-h); left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

/* ── Left sidebar ────────────────────────────────────────────────── */
.studio-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-min);
  max-width: var(--sidebar-max);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  transition: width .28s cubic-bezier(.4,0,.2,1),
              min-width .28s cubic-bezier(.4,0,.2,1);
}

.studio-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-right: none;
  overflow: hidden;
}
.studio-sidebar.collapsed > *:not(.sidebar-collapse-tab):not(.sidebar-collapse-tab-container) {
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}

.sidebar-collapse-tab-container {
  position: absolute;
  top: 50%;
  right: -40px;
  transform: translateY(-50%);
  z-index: 20;
  box-sizing: border-box;
  height: fit-content;
  display: flex;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0;
  overflow: visible;
}
.sidebar-collapse-tab-container:hover {
  background: transparent;
}

/* ── Shared Kinhelm-style icon button (collapse / expand / etc.) ───────────
   40x40, transparent background, no border, rounded, icon-only,
   hover:opacity-50. Used for collapse tab, header btn, floating expand. */
.kinhelm-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border: none;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  height: 40px;
  min-height: 40px;
  width: 40px;
  min-width: 40px;
  border-radius: 6px;
  cursor: pointer;
  pointer-events: auto;
  color: var(--text, #fff);
  outline: none;
  transition: opacity .15s ease, background-color .15s ease, border-color .15s ease;
  flex-shrink: 0;
}
.kinhelm-icon-btn:enabled:hover { opacity: .5; }
.kinhelm-icon-btn:disabled { border: none; cursor: default; }
.kinhelm-icon-btn:focus-visible {
  outline: 2px solid var(--irc-teal, #00D4AA);
  outline-offset: 2px;
}
/* Compact variant — used in sidebar header where space is tighter.     */
.kinhelm-icon-btn--sm {
  height: 28px;
  min-height: 28px;
  width: 28px;
  min-width: 28px;
  border-radius: 5px;
}

.kinhelm-icon-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s cubic-bezier(.4,0,.2,1);
  color: currentColor;
  line-height: 0;
}
.kinhelm-icon-btn-icon > svg {
  height: 20px;
  width: 20px;
  display: block;
}
.kinhelm-icon-btn--sm .kinhelm-icon-btn-icon > svg {
  height: 16px;
  width: 16px;
}

/* Legacy aliases — IDs work with new class names                        */
#sidebarCollapseTab.kinhelm-icon-btn { color: var(--text, #fff); }
#sidebarHeaderCollapseBtn.kinhelm-icon-btn { color: var(--text-muted, #9694B5); }
#sidebarHeaderCollapseBtn.kinhelm-icon-btn:hover { color: var(--irc-teal, #00D4AA); }

/* Flip icon horizontally when sidebar is collapsed — arrow points right */
.studio-sidebar.collapsed #sidebarCollapseTab .kinhelm-icon-btn-icon {
  transform: scaleX(-1);
}

/* Snap tab container to left edge when collapsed so it stays clickable  */
.studio-sidebar.collapsed .sidebar-collapse-tab-container {
  right: auto;
  left: 0;
  border-radius: 0 4px 4px 0;
}

.sidebar-resize-handle {
  position: absolute; right: -3px; top: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 10; transition: background .15s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging { background: var(--irc-blue); }

.sidebar-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px 10px;
}
.sidebar-brand-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.sidebar-title {
  font-size: .78rem; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em;
  display: flex; align-items: center; gap: 7px;
}
.sidebar-title-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--irc-teal);
  box-shadow: 0 0 6px var(--irc-teal);
  flex-shrink: 0;
}
.github-repo-badge {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px; font-size: .72rem; color: var(--text-muted);
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  border-radius: 4px; text-decoration: none; transition: border-color .2s, color .2s;
}
.github-repo-badge:hover { border-color: var(--irc-blue); color: var(--irc-teal); }

/* ── Prompt history ──────────────────────────────────────────────── */
.prompt-history {
  flex: 1 1 0; overflow-y: auto; padding: 8px;
}
.prompt-history::-webkit-scrollbar { width: 3px; }
.prompt-history::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

.prompt-history-item {
  padding: 9px 11px; margin-bottom: 5px;
  border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color .15s; cursor: default;
  animation: slide-in-up .18s ease;
}
.prompt-history-item.active {
  border-color: var(--irc-blue);
  background: rgba(72,38,253,.1);
}
.prompt-history-item:hover { border-color: var(--border-strong); }
.prompt-user    { font-size:.84rem; font-weight:500; line-height:1.45; color:var(--text); }
.prompt-assistant { font-size:.78rem; color:var(--irc-teal); margin-top:4px; line-height:1.4; }
.prompt-notes   { font-size:.72rem; font-style:italic; color:var(--text-muted); margin-top:3px; }
.prompt-meta    { display:flex; align-items:center; gap:6px; margin-top:6px; flex-wrap:wrap; }

.commit-link {
  font-family: var(--font-mono); font-size:.68rem;
  color: #8194DD; text-decoration:none;
}
.commit-link:hover { color: var(--irc-teal); text-decoration:underline; }

/* ── Run ID debug badge ─────────────────────────────────────────── */
.run-id-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--irc-teal);
  background: rgba(127,103,254,.08);
  border: 1px solid rgba(127,103,254,.25);
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: default;
}
.run-id-badge i { font-size: .65rem; opacity: .7; }

/* ── Pipeline progress bar (shimmer animation) ──────────────────── */
@keyframes shimmerSweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.pipeline-progress {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0; padding: 10px 14px 8px;
}
.pipeline-status-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 5px;
  flex-wrap: wrap;
}
.shimmer-bar-track {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgb(30, 15, 80);
  overflow: hidden;
  margin-bottom: 4px;
}
.shimmer-bar-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: rgb(46, 24, 150);
  transition: width 0.5s ease;
}
.shimmer-bar-glow {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.shimmer-bar-glow.active { opacity: 1; }
.shimmer-bar-glow::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    transparent 30%,
    rgba(120, 90, 200, 0.6) 45%,
    rgba(160, 130, 220, 0.9) 50%,
    rgba(120, 90, 200, 0.6) 55%,
    transparent 70%,
    transparent 100%
  );
  animation: shimmerSweep 2.5s ease-in-out infinite;
}
.shimmer-bar-track.done .shimmer-bar-fill {
  background: rgb(46, 24, 150);
}
.shimmer-bar-track.done .shimmer-bar-glow { opacity: 0; }
.build-log-container {
  border-radius: 4px; background: #0a0d10;
  border: 1px solid var(--border); margin-top: 6px;
}
.build-log {
  font-family: var(--font-mono); font-size: .7rem;
  color: #57e389; padding: 8px; max-height: 130px;
  overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.build-log::-webkit-scrollbar { width: 3px; }
.build-log::-webkit-scrollbar-thumb { background: #333; }

/* ── Prompt input ────────────────────────────────────────────────── */
.sidebar-input-area {
  flex-shrink: 0; border-top: 1px solid var(--border);
  padding: 10px 12px 12px; background: var(--surface);
}
.vibe-prompt-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.vibe-prompt-box:focus-within {
  border-color: var(--irc-blue);
  box-shadow: 0 0 0 3px rgba(72,38,253,.18);
}
.vibe-textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-ui);
  font-size: .875rem; line-height: 1.6; resize: none;
  padding: 10px 12px 4px;
  /* Ensure the multi-line placeholder is visible without scrolling */
  min-height: 168px;
}
.vibe-textarea::placeholder { color: var(--text-subtle); }
.vibe-prompt-toolbar {
  border-top: 1px solid var(--border); padding: 4px 8px 6px;
  display: flex; align-items: center; justify-content: space-between;
}

.btn-vibe-primary {
  background: var(--irc-blue); color: #fff;
  border: none; border-radius: 0;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 7px 18px; cursor: pointer;
  transition: background .2s;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-vibe-primary:hover  { background: var(--irc-teal); color: #070513; }
.btn-vibe-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ── Right preview panel ─────────────────────────────────────────── */
.studio-preview {
  flex: 1 1 0; display: flex; flex-direction: column;
  overflow: hidden; background: #0a0d10;
}
.preview-header {
  height: 42px; background: var(--irc-dark);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  padding: 0 10px; display: flex; align-items: center; gap: 8px;
}
.preview-url-bar {
  flex: 1 1 0; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1); border-radius: 4px;
  height: 28px; padding: 0 10px;
  display: flex; align-items: center; gap: 6px;
}
/* ── Preview URL text + inline Run ID chip ─────────────────────────
   .preview-url-text is now a flex row so the URL text (#previewUrlText)
   and the run-ID chip (.preview-inline-run-id) sit side-by-side within
   the same #previewUrlDisplay div, with the URL text truncating first
   when space is tight.
   ─────────────────────────────────────────────────────────────────── */
.preview-url-text {
  font-family: var(--font-mono); font-size: .74rem;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; min-width: 0;
}
/* URL text portion — truncates when space is tight */
#previewUrlText {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 1; min-width: 0;
}

/* ── Inline Run ID chip inside the preview URL bar ───────────────────
   Sits directly inside #previewUrlDisplay alongside the URL text.
   Hidden (d-none) until an agent run starts; cleared after completion.
   ─────────────────────────────────────────────────────────────────── */
.preview-inline-run-id {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;          /* never gets squashed away */
  white-space: nowrap;
  overflow: hidden;
}
.preview-run-id-sep {
  color: var(--text-subtle);
  font-size: .8rem;
  opacity: .5;
  flex-shrink: 0;
}
.preview-run-id-uuid {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--irc-teal);
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;        /* truncate gracefully on narrow screens */
  cursor: default;
  user-select: all;
  animation: pulse-teal-text 2.5s ease-in-out infinite;
}
@keyframes pulse-teal-text {
  0%, 100% { opacity: 1; }
  50%       { opacity: .55; }
}
.preview-run-id-launch {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(127,103,254,.3);
  color: var(--text-subtle);
  font-size: .68rem;
  width: 18px; height: 18px;
  padding: 0;
  cursor: pointer;
  border-radius: 3px;
  line-height: 1;
  transition: color .15s, background .15s, border-color .15s;
}
.preview-run-id-launch:hover {
  color: var(--irc-teal);
  border-color: var(--irc-teal);
  background: rgba(127,103,254,.1);
}

.preview-url-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-subtle); flex-shrink: 0; transition: background .3s;
}
.preview-url-dot.running {
  background: var(--irc-teal); box-shadow: 0 0 5px var(--irc-teal);
}
.preview-viewport {
  flex: 1 1 0; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(65.73% 38.37% at 85% 15%, rgba(48, 28, 157, 0.5) 0%, rgba(0, 0, 0, 0) 100%), radial-gradient(64.25% 63.44% at 15% 85%, rgba(48, 28, 157, 0.5) 0%, rgba(0, 0, 0, 0) 100%), linear-gradient(0deg, rgb(7, 13, 25) 0%, rgb(7, 13, 25) 100%), radial-gradient(37.01% 36.22% at 0% 0%, rgba(32, 21, 107, 0.55) 51.64%, transparent 100%), rgb(19, 19, 19);
}
.preview-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  overflow-y: auto;
  padding-top: 80px;
  padding-bottom: 40px;
  box-sizing: border-box;
}
.preview-iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: none; background: #fff;
  transition: width .3s, height .3s;
}
.preview-iframe.mobile {
  width: 375px; height: 667px; position: relative; border-radius: 8px;
  box-shadow: 0 0 0 2px var(--border-strong), 0 20px 60px rgba(0,0,0,.5);
}
.preview-iframe.tablet {
  width: 768px; height: 100%; position: relative; border-radius: 6px;
  box-shadow: 0 0 0 2px var(--border-strong), 0 20px 60px rgba(0,0,0,.5);
}
.preview-footer {
  background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0;
}
.preview-footer-toggle {
  height: 30px; padding: 0 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.container-logs {
  max-height: 180px; overflow-y: auto; border-top: 1px solid var(--border);
}
.logs-content {
  font-family: var(--font-mono); font-size: .7rem; color: #57e389;
  background: transparent; margin: 0; padding: 8px 12px;
  white-space: pre-wrap; word-break: break-all;
}
.container-logs::-webkit-scrollbar { width: 3px; }
.container-logs::-webkit-scrollbar-thumb { background: #333; }

/* ── Start / placeholder states ──────────────────────────────────── */
.start-state { max-width: 540px; padding: 0 20px 40px; text-align: center; }
.start-icon {
  width: auto; height: auto; border-radius: 10px; margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
}
.start-icon img { width: 200px; height: auto; }
.example-prompt-btn {
  font-size: .78rem; border: 1px solid rgba(72,38,253,.5);
  color: var(--irc-blue); background: transparent;
  border-radius: 0; padding: 6px 12px;
  transition: background .2s, color .2s; cursor: pointer;
}
.example-prompt-btn:hover { background: var(--irc-blue); color: #fff; }

/* ── Status badges ───────────────────────────────────────────────── */
.status-badge {
  font-size: .68rem; padding: 2px 8px; border-radius: 3px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap;
}
.status-new      { background:rgba(130,148,221,.15); color:#8194DD; border:1px solid rgba(130,148,221,.3); }
.status-building { background:rgba(245,166,35,.12);  color:#F5A623; border:1px solid rgba(245,166,35,.3); }
/* Project/runtime status colours: green means Docker is running; red means stopped. */
.status-running  { background:rgba(34,197,94,.16);   color:#57e389; border:1px solid rgba(34,197,94,.45); }
.status-stopped  { background:rgba(232,98,10,.16);   color:#ff7b72; border:1px solid rgba(232,98,10,.45); }
.status-error    { background:rgba(232,98,10,.15);   color:#E8620A; border:1px solid rgba(232,98,10,.3); }

/* ── Project cards (index) ───────────────────────────────────────── */
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer; text-decoration: none;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 220px;
}
.project-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--irc-blue), var(--irc-teal));
  transform: scaleX(0); transform-origin: left; transition: transform .25s;
  z-index: 2;
}
.project-card:hover::before { transform: scaleX(1); }
.project-card:hover {
  border-color: var(--irc-blue); transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(72,38,253,.18);
}
.project-card-body {
  position: relative;
  z-index: 1;
  padding: 18px 20px;
  display: flex; flex-direction: column;
  flex: 1 1 auto;
  /* v60 card-click fix: the project-card-body covers the whole card and
     would otherwise capture every click, blocking navigation to the
     project. Make the body click-transparent — the overlay anchor below
     receives the click. Inline links (commit chip, GitHub chip) re-enable
     pointer events so they remain clickable to GitHub. */
  pointer-events: none;
}
.project-card-meta { font-size: .82rem; }
.project-card-footer { padding-top: .5rem; }
.project-card-overlay-link {
  position: absolute; inset: 0;
  z-index: 0;
  text-decoration: none;
  border-radius: inherit;
  /* v60 card-click fix: the body above is pointer-events:none, so this
     anchor — even though it has the lower z-index — is the only element
     that receives clicks over the full card surface. */
  pointer-events: auto;
}
.project-card-overlay-link:focus-visible {
  outline: 2px solid var(--irc-blue);
  outline-offset: -2px;
}
.project-card-link-inline {
  position: relative;
  z-index: 3;
  /* v60 card-click fix: re-enable clicks on the GitHub commit SHA chip
     and GitHub repo chip so they open GitHub instead of opening the
     project. */
  pointer-events: auto;
}
.project-name { font-size:1rem; font-weight:600; color:var(--text); }

/* ── History page ────────────────────────────────────────────────── */
.history-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.history-card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
}
.history-card-body { padding: 14px 16px; }
.revision-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.revision-item:last-child { border-bottom: none; }
.revision-item.current {
  background: rgba(72,38,253,.06); border-radius: 6px; padding: 12px 10px; margin: 0 -10px;
}
.revision-marker { flex-shrink: 0; padding-top: 2px; font-size: 1rem; }
.sha-chip {
  font-family: var(--font-mono); font-size: .7rem; color: #8194DD; text-decoration: none;
  padding: 1px 5px; background: rgba(130,148,221,.1);
  border-radius: 3px; border: 1px solid rgba(130,148,221,.2);
}
.sha-chip:hover { color: var(--irc-teal); }
.audit-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.audit-item:last-child { border-bottom: none; }
.audit-icon {
  width: 26px; height: 26px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .75rem;
}
.audit-agent_request   { background:rgba(72,38,253,.15);   color:var(--irc-blue); }
.audit-agent_response  { background:rgba(127,103,254,.12);    color:var(--irc-teal); }
.audit-docker_build, .audit-docker_build_result { background:rgba(245,166,35,.1); color:var(--irc-amber); }
.audit-docker_run, .audit-docker_run_result     { background:rgba(130,148,221,.12); color:#8194DD; }
.audit-rollback        { background:rgba(232,98,10,.12);    color:var(--irc-orange); }
.audit-github_commit   { background:rgba(127,103,254,.08);    color:var(--irc-teal); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px; text-align: center;
}
.stat-icon { font-size: 1.3rem; margin-bottom: 5px; }
.stat-value { font-size: 1.2rem; font-weight: 700; margin-bottom: 2px; }
.stat-label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ── Files modal ─────────────────────────────────────────────────── */
.vibe-modal {
  background: #161b22; border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
.file-tree {
  font-family: var(--font-mono); font-size: .78rem; max-height: 62vh;
  overflow: auto; padding-right: 2px;
}
.file-tree-row {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
  border: 0; background: transparent; text-align: left; color: var(--text-muted);
  padding: 5px 8px 5px calc(8px + (var(--tree-depth, 0) * 16px));
  border-radius: 4px; cursor: pointer; transition: background .15s, color .15s;
}
.file-tree-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tree-row:hover { background: var(--surface-2); color: var(--text); }
.file-tree-row:focus-visible { outline: 2px solid var(--irc-teal); outline-offset: -2px; }
.file-tree-item.active { background: rgba(72,38,253,.15); color: var(--irc-teal); }
.file-tree-folder { font-weight: 600; }
.file-tree-folder-icon { color: var(--irc-teal); }
.file-tree-caret { font-size: .68rem; transition: transform .12s ease; color: var(--text-muted); }
.file-tree-folder.expanded .file-tree-caret { transform: rotate(90deg); }
.file-content-preview {
  display: block; width: 100%; resize: vertical;
  font-family: var(--font-mono); font-size: .76rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 12px; color: #c9d1d9;
  min-height: 430px; max-height: 62vh; overflow: auto; white-space: pre;
  word-break: normal; margin: 0;
}
.file-content-preview:focus {
  outline: none; border-color: var(--irc-blue);
  box-shadow: 0 0 0 3px rgba(72,38,253,.18);
}
.vibe-input {
  background: var(--surface-2) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: 4px !important;
}
.vibe-input:focus {
  border-color: var(--irc-blue) !important;
  box-shadow: 0 0 0 3px rgba(72,38,253,.18) !important;
}
.vibe-select {
  background: var(--surface-2) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: 4px !important; font-size: .78rem;
}
.vibe-dropdown { background: #161b22 !important; border: 1px solid var(--border) !important; }

/* ── Utility ─────────────────────────────────────────────────────── */
.btn-xs { padding: 3px 8px; font-size: .72rem; border-radius: 4px; line-height: 1.5; }
.btn-ghost { background: transparent; border: 1px solid transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.vx-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }

/* ── Index hero ──────────────────────────────────────────────────── */
.hero-gradient {
  background: linear-gradient(135deg, #070e19 0%, #0a1a3e 33%, #0d2670 66%, #1034a3 100%);
}
.hero-teal-rule { width: 48px; height: 4px; background: var(--irc-teal); margin: 14px 0; }

/* ── Scrollbars ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ── Non-studio pages (scrollable) ──────────────────────────────── */
body.page-index, body.page-history,
body.page-account, body.page-login, body.page-register {
  /* v54: opt non-studio pages back into vertical scrolling.
     html/body have `overflow: hidden` by default to lock the main
     Studio surface, so pages like GitHub Settings, Account, Login
     and Register need this rule to scroll on short viewports. */
  overflow: auto;
}
.flash-container {
  position: fixed; top: calc(var(--navbar-h) + 8px); left: 50%; transform: translateX(-50%);
  z-index: 999; width: 90%; max-width: 600px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
/* Tablet: stack sidebar + preview vertically */
@media (max-width: 768px) and (min-width: 481px) {
  .studio-layout { flex-direction: column; }
  .studio-sidebar { width: 100%; min-width: 100%; max-width: 100%; height: 45%; }
  .sidebar-resize-handle { display: none; }
  .studio-preview { height: 55%; }
}

/* ── Smartphone: hide preview, full-height sidebar + action bar ── */
@media (max-width: 480px) {
  .studio-layout { flex-direction: column; }
  .studio-sidebar {
    width: 100% !important; min-width: 100% !important; max-width: 100% !important;
    height: auto !important; flex: 1 1 0; overflow-y: auto;
  }
  .studio-sidebar.collapsed {
    width: 0 !important; min-width: 0 !important; flex: 0 0 0;
  }
  .sidebar-resize-handle { display: none !important; }
  .sidebar-collapse-tab-container { display: none !important; }
  /* Hide the preview panel entirely on smartphones */
  .studio-preview { display: none !important; }
  /* Show the mobile action bar instead */
  .mobile-action-bar { display: flex !important; }
  /* Make the navbar wrap gracefully on very small screens */
  .vibe-navbar > .ms-auto { gap: 4px !important; }
  .vibe-navbar .github-chip { display: none !important; }
  .vibe-navbar .vibe-project-badge { max-width: 100px; font-size: .65rem; }
  #deployGuideToggle span,
  #debugPanelToggle span,
  #secretsDrawerToggle > span:not(.secrets-nav-badge),
  #shareLinkToggle span,
  #reaperToggleBtn span { display: none !important; }
  .secrets-nav-btn { padding: 3px 6px !important; font-size: .68rem !important; }
  /* Sprint plan modal — full width on phone */
  #sprintPlanModal > div { width: 100vw !important; max-width: 100vw !important; border-radius: 0 !important; }
  /* Pipeline progress — more compact */
  .pipeline-progress { padding: 8px 10px 6px; }
  /* Prompt textarea — shorter default */
  .vibe-textarea { min-height: 120px; }
  /* Drawers — full width on phone */
  .secrets-drawer { width: 100vw !important; max-width: 100vw !important; }
}

/* Mobile action bar — hidden on desktop/tablet, shown on smartphone */
.mobile-action-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-action-bar .mobile-open-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--irc-blue);
  background: rgba(72,38,253,.12);
  color: var(--irc-blue);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.mobile-action-bar .mobile-open-tab-btn:hover {
  background: var(--irc-blue);
  color: #fff;
}
.mobile-action-bar .mobile-open-tab-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.mobile-action-bar .mobile-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
}
.mobile-action-bar .mobile-status-dot.running {
  background: var(--irc-teal);
  box-shadow: 0 0 6px var(--irc-teal);
}

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes slide-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-teal {
  0%, 100% { box-shadow: 0 0 0 0 rgba(127,103,254,.4); }
  50%       { box-shadow: 0 0 0 8px rgba(127,103,254,0); }
}
.building .vibe-prompt-box { animation: pulse-teal 2s infinite; }

/* ── GitHub Import repo rows ─────────────────────────────────────── */
.repo-row:hover:not([style*="opacity:.55"]) {
  background: rgba(255,255,255,.03);
}
.repo-row .repo-checkbox:focus {
  box-shadow: 0 0 0 2px rgba(72,38,253,.35);
}

/* ── Attachment chips ─────────────────────────────────────────────── */
.attachment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px 2px 6px;
  border-radius: 4px;
  font-size: .7rem;
  font-family: var(--font-mono);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color .15s;
}
.attachment-chip:hover { border-color: var(--irc-orange); }
.attachment-chip .chip-icon { flex-shrink: 0; font-size: .7rem; }
.attachment-chip .chip-name { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.attachment-chip .chip-size { color: var(--text-subtle); font-size: .62rem; flex-shrink: 0; }
.attachment-chip .chip-remove {
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-subtle);
  font-size: .65rem;
  padding: 0 2px;
  border-radius: 2px;
  line-height: 1;
}
.attachment-chip .chip-remove:hover { color: var(--irc-orange); background: rgba(232,98,10,.15); }
.attachment-chip.chip-image { border-color: rgba(127,103,254,.3); }
.attachment-chip.chip-text  { border-color: rgba(72,38,253,.3); }
.attachment-chip.chip-large { border-color: rgba(245,166,35,.3); color: var(--irc-amber); }

/* Drop-zone highlight when dragging files over the prompt box */
.vibe-prompt-box.drag-over {
  border-color: var(--irc-teal) !important;
  box-shadow: 0 0 0 3px rgba(127,103,254,.2) !important;
}

/* ── Attachment zone — clickable + drop target ───────────────────── */
.attach-zone {
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  min-height: 36px;
}
.attach-zone:hover,
.vibe-prompt-box.drag-over .attach-zone {
  background: rgba(72,38,253,.07);
  border-color: rgba(72,38,253,.4);
}
.vibe-prompt-box.drag-over .attach-zone {
  background: rgba(127,103,254,.08);
  border-color: rgba(127,103,254,.5);
}
.attach-zone-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  user-select: none;
}
.attach-zone-inner.has-files {
  display: none;
}
.attach-zone-icon {
  font-size: .95rem;
  color: var(--irc-blue);
  flex-shrink: 0;
  transition: color .15s, transform .15s;
}
.attach-zone:hover .attach-zone-icon,
.vibe-prompt-box.drag-over .attach-zone-icon {
  color: var(--irc-teal);
  transform: scale(1.15);
}
.attach-zone-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color .15s;
}
.attach-zone:hover .attach-zone-label,
.vibe-prompt-box.drag-over .attach-zone-label {
  color: var(--irc-teal);
}
.attach-zone-types {
  font-size: .65rem;
  color: var(--text-subtle);
  margin-left: auto;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Run button ──────────────────────────────────────────────────── */
#runContainerBtn {
  color: var(--irc-teal);
  font-size: .85rem;
}
#runContainerBtn:hover:not(:disabled) {
  color: var(--irc-blue);
  background: rgba(127,103,254,.12);
}
#runContainerBtn:disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
}

/* ================================================================
   Secrets Drawer  (v19)
   ================================================================ */

.secrets-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--irc-teal);
  border: 1px solid rgba(127,103,254,.35);
  border-radius: 4px;
  padding: 3px 10px;
  background: rgba(127,103,254,.08);
  transition: background .15s, border-color .15s, color .15s;
  cursor: pointer;
  white-space: nowrap;
}
.secrets-nav-btn:hover,
.secrets-nav-btn.active {
  background: rgba(127,103,254,.18);
  border-color: var(--irc-teal);
  color: #fff;
}
.secrets-nav-badge {
  display: inline-block;
  background: var(--irc-teal);
  color: #111;
  border-radius: 10px;
  padding: 0 6px;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.4;
}

.secrets-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1100;
  backdrop-filter: blur(2px);
  animation: backdrop-in .2s ease;
}
.secrets-backdrop.open { display: block; }
@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.secrets-drawer {
  position: fixed;
  top: var(--navbar-h);
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  z-index: 1101;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  box-shadow: -12px 0 48px rgba(0,0,0,.45);
}
.secrets-drawer.open {
  transform: translateX(0);
}

.secrets-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-2);
}

.secrets-drawer > .secrets-drawer-section,
.secrets-drawer > .secrets-callout {
  flex-shrink: 0;
}
.secrets-drawer-section:nth-child(3) {
  flex: 1 1 0;
  overflow-y: auto;
}
.secrets-drawer-section::-webkit-scrollbar { width: 3px; }
.secrets-drawer-section::-webkit-scrollbar-thumb { background: var(--surface-3); }

/* ── Share drawer: make the active-links section scrollable ──── */
#shareDrawer { overflow: hidden; display: flex; flex-direction: column; }
#shareDrawer > .secrets-drawer-header,
#shareDrawer > .secrets-callout { flex-shrink: 0; }
#shareDrawer > .secrets-drawer-section { flex-shrink: 0; }
#shareDrawer > .secrets-drawer-section:last-child {
  flex: 1 1 0;
  overflow-y: auto;
  min-height: 0;
}
#shareDrawer > .secrets-drawer-section:last-child::-webkit-scrollbar { width: 3px; }
#shareDrawer > .secrets-drawer-section:last-child::-webkit-scrollbar-thumb { background: var(--surface-3); }
#shareTokenList {
  max-height: 100%;
  overflow-y: auto;
}

.secrets-drawer-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.secrets-callout {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(127,103,254,.06);
  border-bottom: 1px solid rgba(127,103,254,.18);
  font-size: .74rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.secrets-callout-icon {
  font-size: 1.1rem;
  color: var(--irc-teal);
  flex-shrink: 0;
  margin-top: 1px;
}
.secrets-callout strong { color: var(--text); }
.secrets-callout code {
  font-family: var(--font-mono);
  font-size: .7rem;
  background: rgba(255,255,255,.07);
  padding: 1px 4px;
  border-radius: 3px;
}
.secrets-callout-list {
  margin: 6px 0 0 0;
  padding-left: 16px;
}
.secrets-callout-list li { margin-bottom: 4px; }

.secrets-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

.secrets-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 5px;
  transition: border-color .15s;
}
.secrets-key-row:hover { border-color: var(--border-strong); }
.secrets-key-name {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--irc-teal);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.secrets-key-masked {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-subtle);
  margin-left: 8px;
  letter-spacing: .1em;
}
.secrets-key-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}
.secrets-del-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: .75rem;
  padding: 2px 5px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
  transition: color .15s, background .15s;
}
.secrets-del-btn:hover {
  color: var(--irc-orange);
  background: rgba(232,98,10,.12);
}
.secrets-empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
}

.secrets-action-btn {
  font-size: .7rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
}
.secrets-action-btn:hover {
  color: var(--irc-teal);
  border-color: var(--irc-teal);
  background: rgba(127,103,254,.08);
}

.secrets-form {}
.secrets-form-row { margin-bottom: 8px; }
.secrets-field-wrap { display: flex; flex-direction: column; }
.secrets-field-label {
  font-size: .67rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.secrets-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .82rem;
  padding: 7px 10px;
  border-radius: 4px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.secrets-input:focus {
  border-color: var(--irc-blue);
  box-shadow: 0 0 0 3px rgba(72,38,253,.18);
}
.secrets-value-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.secrets-value-wrap .secrets-input { padding-right: 38px; }
.secrets-reveal-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .82rem;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  transition: color .15s;
}
.secrets-reveal-btn:hover { color: var(--irc-teal); }

.secrets-error {
  background: rgba(232,98,10,.12);
  border: 1px solid rgba(232,98,10,.3);
  border-radius: 4px;
  color: var(--irc-orange);
  font-size: .74rem;
  padding: 6px 10px;
  margin-bottom: 6px;
}

.secrets-usage-hint { flex-shrink: 0; border-bottom: none; }
.secrets-code-block {
  background: #0a0d10;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: #57e389;
  white-space: pre;
  overflow-x: auto;
  margin: 0;
}

@media (max-width: 480px) {
  .secrets-drawer { width: 100vw; }
}

/* ================================================================ */
/*  Project Card — Delete Button  (v21)                             */
/* ================================================================ */
.project-card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}
.btn-delete-project {
  position: relative;
  align-self: end;
  justify-self: end;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0 10px 10px 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: scale(.82);
  transition:
    opacity       .18s ease,
    transform     .18s ease,
    color         .15s,
    background    .15s,
    border-color  .15s;
  pointer-events: none;
}
.project-card-wrap:hover .btn-delete-project,
.project-card-wrap:focus-within .btn-delete-project {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.btn-delete-project:hover,
.btn-delete-project:focus-visible {
  color: #ff6b6b;
  background: rgba(220, 53, 69, .15);
  border-color: rgba(220, 53, 69, .35);
  outline: none;
}
.btn-delete-project:active {
  transform: scale(.9);
  background: rgba(220, 53, 69, .28);
}

/* ================================================================ */
/*  Compare Panel  (v22)                                            */
/* ================================================================ */
.compare-panel {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: var(--shell);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compare-header {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.compare-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.compare-picker-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.compare-select {
  min-width: 200px;
  max-width: 280px;
  font-size: .78rem;
}
.compare-run-btn {
  padding: 5px 14px;
  font-size: .75rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.compare-side-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-a { background: var(--irc-blue); }
.dot-b { background: var(--irc-teal); }

.compare-tab-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.compare-tab {
  padding: 4px 12px;
  font-size: .73rem;
  font-weight: 600;
  background: var(--surface-3);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.compare-tab + .compare-tab { border-left: 1px solid var(--border); }
.compare-tab.active,
.compare-tab:hover {
  background: var(--irc-blue);
  color: #fff;
}

.compare-progress {
  flex-shrink: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.compare-prog-bar-wrap {
  width: 120px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.compare-prog-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--irc-blue), var(--irc-teal));
  border-radius: 2px;
  transition: width .3s ease;
}
.compare-build-log {
  background: #0a0d10;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #8b949e;
  font-size: .68rem;
  font-family: var(--font-mono);
  max-height: 90px;
  overflow-y: auto;
  padding: 6px 10px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.compare-split-view {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.compare-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.compare-pane-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: .75rem;
}
.compare-pane-label {
  font-weight: 600;
  color: var(--text);
  font-size: .78rem;
}
.compare-pane-status {
  font-size: .68rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.compare-pane-status.running { color: var(--irc-teal); }
.compare-iframe { flex: 1; width: 100%; border: none; background: #fff; }

.compare-divider {
  width: 6px;
  cursor: col-resize;
  background: var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  position: relative;
}
.compare-divider:hover,
.compare-divider.dragging { background: var(--irc-blue); }
.compare-divider-handle {
  width: 2px;
  height: 32px;
  background: rgba(255,255,255,.25);
  border-radius: 1px;
}

.compare-diff-view {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.compare-diff-sidebar {
  width: 240px;
  min-width: 160px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.compare-diff-sidebar-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.compare-diff-summary {
  font-size: .68rem;
  color: var(--text-muted);
}
.compare-diff-file-list {
  flex: 1;
  overflow-y: auto;
}
.compare-diff-file-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: .76rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .12s;
  color: var(--text-muted);
  word-break: break-all;
}
.compare-diff-file-item:hover { background: var(--surface-2); color: var(--text); }
.compare-diff-file-item.active { background: rgba(72,38,253,.12); color: var(--irc-blue); }
.compare-diff-file-item .diff-status-badge {
  flex-shrink: 0;
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.diff-status-modified { background: rgba(245,166,35,.18); color: #F5A623; }
.diff-status-added    { background: rgba(127,103,254,.18);  color: var(--irc-teal); }
.diff-status-deleted  { background: rgba(232,98,10,.18);  color: var(--irc-orange); }

.diff-stat-pills {
  margin-left: auto;
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.diff-stat-add { font-size:.6rem; color:#ffffff; font-weight:700; }
.diff-stat-del { font-size:.6rem; color:#E8620A; font-weight:700; }

.compare-diff-content {
  flex: 1;
  overflow: auto;
  min-width: 0;
}
.compare-diff-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}
.compare-diff-pre {
  margin: 0;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1.6;
  white-space: pre;
  background: transparent;
  color: #c9d1d9;
  tab-size: 4;
  overflow: visible;
}
.diff-add  { color: #56d364; background: rgba(86,211,100,.08);  display: block; }
.diff-del  { color: #f85149; background: rgba(248,81,73,.08);   display: block; }
.diff-meta { color: #79c0ff; display: block; }
.diff-hunk { color: #6e7681; display: block; }

@media (max-width: 700px) {
  .compare-split-view { flex-direction: column; }
  .compare-divider    { width: 100%; height: 6px; cursor: row-resize; }
  .compare-select     { min-width: 130px; max-width: 160px; }
  .compare-diff-sidebar { width: 100%; max-height: 160px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ================================================================ */
/*  Deploy Guide Drawer  (v30)                                      */
/* ================================================================ */
.deploy-step {
  padding: .9rem 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.deploy-step:last-child { border-bottom: none; }
.deploy-step-header {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .4rem;
}
.deploy-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(72,38,253,.25);
  border: 1px solid rgba(72,38,253,.45);
  color: #8194DD;
  font-size: .72rem; font-weight: 700;
  flex-shrink: 0;
}
.deploy-step-title {
  font-size: .82rem; font-weight: 600; color: #e6edf3;
}
.deploy-step-title code {
  color: var(--irc-teal);
  background: rgba(127,103,254,.1);
  padding: 1px 5px; border-radius: 3px; font-size: .78rem;
}
.deploy-step-badge {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 2px 7px; border-radius: 10px;
  background: rgba(245,166,35,.18); color: #F5A623;
  border: 1px solid rgba(245,166,35,.3);
}
.deploy-step-desc {
  font-size: .78rem; color: var(--text-muted); margin: 0 0 .55rem; line-height: 1.55;
}
.deploy-step-desc code {
  color: #c9d1d9; background: rgba(255,255,255,.07);
  padding: 1px 5px; border-radius: 3px; font-size: .76rem;
}
.deploy-code-block {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  padding: .65rem .85rem;
  font-family: 'JetBrains Mono',Consolas,monospace;
  font-size: .72rem; color: #c9d1d9; line-height: 1.6;
  white-space: pre; overflow-x: auto; margin: 0 0 .35rem;
}
.deploy-copy-btn {
  font-size: .7rem; padding: 2px 10px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05);
  color: var(--text-muted); cursor: pointer;
  transition: color .15s, background .15s; margin-bottom: .25rem;
}
.deploy-copy-btn:hover { background: rgba(255,255,255,.1); color: #c9d1d9; }
.deploy-info-box {
  display: flex; align-items: flex-start; gap: .5rem; padding: .6rem .85rem;
  border-radius: 5px; background: rgba(72,38,253,.08);
  border: 1px solid rgba(72,38,253,.2); font-size: .76rem; color: #c9d1d9; line-height: 1.5;
}
.deploy-info-box code {
  color: var(--irc-teal); background: rgba(127,103,254,.1); padding: 1px 4px; border-radius: 3px;
}
.deploy-warn-box {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .85rem;
  border-radius: 5px; background: rgba(232,98,10,.08);
  border: 1px solid rgba(232,98,10,.25); font-size: .76rem; color: var(--irc-orange);
}
.deploy-var-table-wrap {
  overflow-x: auto; margin-top: .6rem;
  border-radius: 6px; border: 1px solid rgba(255,255,255,.1);
}
.deploy-var-table { width: 100%; border-collapse: collapse; font-size: .73rem; }
.deploy-var-table thead th {
  padding: .4rem .7rem; background: rgba(255,255,255,.04);
  color: var(--text-muted); font-weight: 600; text-transform: uppercase;
  font-size: .63rem; letter-spacing: .05em;
  border-bottom: 1px solid rgba(255,255,255,.1); white-space: nowrap;
}
.deploy-var-table tbody td {
  padding: .42rem .7rem; color: #c9d1d9;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: top; line-height: 1.45;
}
.deploy-var-table tbody tr:last-child td { border-bottom: none; }
.deploy-var-table tbody tr.deploy-row-studio td { background: rgba(232,98,10,.05); }
.deploy-var-table code {
  color: var(--irc-teal); background: rgba(127,103,254,.1);
  padding: 1px 5px; border-radius: 3px; font-size: .7rem; white-space: nowrap;
}
.deploy-badge-required {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .62rem;
  font-weight: 700; background: rgba(127,103,254,.15); color: var(--irc-teal);
  border: 1px solid rgba(127,103,254,.3); white-space: nowrap;
}
.deploy-badge-conditional {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .62rem;
  font-weight: 700; background: rgba(72,38,253,.18); color: #8194DD;
  border: 1px solid rgba(72,38,253,.3); white-space: nowrap;
}
.deploy-badge-optional {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .62rem;
  font-weight: 700; background: rgba(232,98,10,.15); color: var(--irc-orange);
  border: 1px solid rgba(232,98,10,.3); white-space: nowrap;
}
.deploy-checklist { list-style: none; padding: 0; margin: 0 0 .55rem; }
.deploy-checklist li {
  display: flex; align-items: flex-start; gap: .5rem;
  font-size: .77rem; color: #c9d1d9; padding: .25rem 0; line-height: 1.45;
}
.deploy-checklist li code {
  color: var(--irc-teal); background: rgba(127,103,254,.1);
  padding: 1px 5px; border-radius: 3px; font-size: .73rem;
}
.deploy-checklist li i { flex-shrink: 0; margin-top: 2px; }
@media (max-width: 600px) {
  .deploy-var-table-wrap { font-size: .68rem; }
  .deploy-code-block { font-size: .66rem; }
}



/* ── Sidebar header collapse button ───────────────────────────────────────
   Now uses shared .kinhelm-icon-btn (compact variant). This block is kept
   for back-compat selectors only.                                         */
.sidebar-header-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #9694B5);
  border-radius: 5px;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity .15s ease;
  flex-shrink: 0;
}
.sidebar-header-collapse-btn:hover { opacity: .5; color: var(--irc-teal, #00D4AA); }
.sidebar-header-collapse-btn:active { transform: translateY(1px); }

/* Hide the edge tab while collapsed — floating expand btn is the
   visible re-expand affordance.                                           */
.studio-sidebar.collapsed .sidebar-collapse-tab-container,
.studio-sidebar.collapsed #sidebarCollapseTab {
  opacity: 0;
  pointer-events: none;
}

/* ── Preview-header expand button ─────────────────────────────────────────
   Lives inside .preview-header. Hidden by default; shown only when the
   sidebar is collapsed. Uses the shared .kinhelm-icon-btn appearance.      */
.sidebar-expand-btn-wrap { display: none; flex-shrink: 0; }
.sidebar-expand-btn {
  display: none;                  /* hidden when sidebar is expanded     */
  color: var(--text, #fff);
}
.studio-layout:has(.studio-sidebar.collapsed) .sidebar-expand-btn-wrap,
.studio-layout.sidebar-is-collapsed .sidebar-expand-btn-wrap {
  display: inline-flex;
}
.studio-layout:has(.studio-sidebar.collapsed) .sidebar-expand-btn,
.studio-layout.sidebar-is-collapsed .sidebar-expand-btn {
  display: inline-flex;
}

/* Expand icon flipped so arrow points away from sidebar (rightward)     */
.sidebar-expand-icon { transform: scaleX(-1); }

@media (max-width: 768px) {
  .sidebar-expand-btn,
  .sidebar-expand-btn-wrap { display: none !important; }
}

/* ── v64/v66-fix: Branch selector & create ─────────────────────────── */
.branch-selector-row {
  display: flex; flex-direction: column; gap: 0;
  padding: 0 0 8px; margin: 0;
  position: relative;
}
.branch-selector-main {
  display: flex; align-items: center; gap: 8px; width: 100%;
  flex-shrink: 0; z-index: 1;
}
.branch-selector-label {
  font-size: .7rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; display: flex; align-items: center; gap: 4px;
  font-family: var(--font-ui); flex-shrink: 0;
}
.branch-selector-label i { font-size: .72rem; color: var(--irc-teal); }
.branch-select-wrapper { flex: 1; min-width: 0; }
.branch-select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font-family: var(--font-mono, monospace);
  font-size: .72rem; padding: 4px 28px 4px 8px; line-height: 1.4;
  cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B8FA8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.branch-select:focus {
  border-color: var(--irc-blue);
  box-shadow: 0 0 0 2px rgba(72,38,253,.15);
}
.branch-select:hover { border-color: var(--irc-blue); }
.branch-select option {
  background: var(--surface); color: var(--text);
  font-family: var(--font-mono, monospace); font-size: .72rem;
}
/* New-branch toggle link */
.branch-new-toggle {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: .66rem; font-weight: 600; color: var(--irc-teal);
  display: inline-flex; align-items: center; gap: 3px;
  opacity: .85; transition: opacity .15s;
  font-family: var(--font-ui); flex-shrink: 0;
}
.branch-new-toggle:hover { opacity: 1; text-decoration: underline; }
/* Create-branch row — sits below the selector row, hidden by default */
.branch-create-wrap {
  display: flex; flex-direction: column; gap: 3px;
  width: 100%; padding: 6px 0 0;
  margin-top: 2px;
  border-top: 1px solid rgba(127,103,254,.15);
}
.branch-create-input-row {
  display: flex; align-items: center; gap: 6px; width: 100%;
}
.branch-create-input {
  flex: 1; min-width: 0; height: 26px; padding: 3px 8px;
  border-radius: 4px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-family: var(--font-mono, monospace); font-size: .72rem;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.branch-create-input::placeholder { color: var(--text-muted); opacity: .6; }
.branch-create-input:focus {
  border-color: var(--irc-teal);
  box-shadow: 0 0 0 2px rgba(0,212,170,.15);
}
.branch-create-btn {
  flex-shrink: 0; height: 26px; padding: 0 8px;
  border-radius: 4px; border: 1px solid var(--border);
  background: rgba(0,212,170,.1); color: var(--irc-teal);
  font-size: .72rem; cursor: pointer; display: inline-flex;
  align-items: center; gap: 4px; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.branch-create-btn:hover {
  background: rgba(0,212,170,.2); border-color: var(--irc-teal);
}
.branch-create-btn:disabled { opacity: .5; cursor: not-allowed; }
.branch-create-cancel {
  background: none; border: none; cursor: pointer; padding: 0 2px;
  color: var(--text-muted); font-size: .82rem; line-height: 1;
  opacity: .7; transition: opacity .15s;
}
.branch-create-cancel:hover { opacity: 1; color: var(--irc-orange); }
.branch-create-hint {
  font-size: .6rem; line-height: 1.2; color: var(--text-muted);
  padding-left: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
