:root {
  --bg: #14120d;
  --panel: #1a1712;
  --panel-elev: #201c16;
  --panel-editor: #191611;
  --panel-card: #242019;
  --border: #332d25;
  --border-soft: #2a251e;
  --text: #e8e4de;
  --text-muted: #b0a99d;
  --text-dim: #8f8678;
  --primary: #f54e00;
  --primary-rgb: 245, 78, 0;
  --primary-strong: #ff7b40;
  --grind-orange: #c08532;
  --grind-orange-rgb: 192, 133, 50;
  --grind-orange-strong: #e0b067;
  --positive: #67ba72;
  --negative: #c66b6b;
  --center-content-max: 980px;
  --chat-bubble-max: 720px;
  --thread-side-padding: 60px;
  --scrollbar-size: 10px;
  --scrollbar-track: #1a1712;
  --scrollbar-thumb: #5d5549;
  --scrollbar-thumb-hover: #756b5d;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}

.studio-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.studio-window {
  width: min(1500px, 100%);
  height: min(840px, calc(100vh - 2rem));
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.studio-header {
  height: 30px;
  border-bottom: 1px solid var(--border);
  padding: 0 0.6rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
}

.studio-header__center {
  color: #9f9fa4;
}

.studio-header__left {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: #d7d1c6;
}

.brand-logo {
  width: 12px;
  height: 13px;
  display: block;
  color: #e2dcd2;
}

.studio-header__right {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--grind-orange);
}

.mobile-subbar {
  display: none;
  border-bottom: 1px solid var(--border);
  min-height: 50px;
  align-items: center;
  padding: 0 0.5rem;
}

.mobile-left-tab {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #8e867b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-right: 0.1rem;
  cursor: pointer;
}

.mobile-left-tab svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-left-tab:hover {
  color: #b8b1a6;
}

.mobile-subbar .doc-tab {
  font-size: 13px;
  min-height: 34px;
  padding: 0 0.8rem;
}

.mobile-subbar .doc-tab:disabled {
  opacity: 0.5;
}

.mobile-left-backdrop {
  display: none;
}

.studio-body {
  --right-pane-width: 0px;
  height: calc(100% - 30px);
  position: relative;
  display: grid;
  grid-template-columns: 200px 1fr var(--right-pane-width);
  transition: grid-template-columns 280ms ease;
}

.studio-body:not(.has-right-pane) {
  --center-content-max: 760px;
  --chat-bubble-max: 620px;
}

.studio-body.has-right-pane {
  --right-pane-width: 470px;
}

.pane {
  min-width: 0;
  min-height: 0;
}

.pane--left,
.pane--center {
  border-right: 1px solid var(--border);
}

.pane--left {
  background: var(--panel);
  padding: 0.55rem 0.5rem;
  display: flex;
  flex-direction: column;
}

.left-toolbar {
  display: grid;
  gap: 0.45rem;
}

.search-input {
  width: 100%;
  height: 27px;
  border: 1px solid var(--border);
  background: var(--panel-editor);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0 0.55rem;
  font-size: 12px;
}

.new-agent-btn {
  width: 100%;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: #d2d2d6;
  background: var(--panel-editor);
  font-size: 12px;
}

.left-section-title {
  margin-top: 0.7rem;
  margin-bottom: 0.4rem;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.task-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.task-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-card);
  padding: 0.55rem;
}

.task-card__title {
  font-size: 12px;
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.pane--center {
  background: var(--panel-editor);
  display: flex;
  flex-direction: column;
}

.thread-title {
  width: min(var(--center-content-max), calc(100% - (var(--thread-side-padding) * 2)));
  margin: 0 auto;
  padding: 0.55rem 0.85rem 0.2rem;
  font-size: 12px;
  color: #dbdbde;
}

.thread-subtitle {
  width: min(var(--center-content-max), calc(100% - (var(--thread-side-padding) * 2)));
  margin: 0 auto;
  padding: 0 0.85rem 0.65rem;
  font-size: 10px;
  color: var(--text-dim);
}

.thread-stream {
  width: min(var(--center-content-max), calc(100% - (var(--thread-side-padding) * 2)));
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 0.85rem;
}

.thread-stream > * {
  width: min(100%, var(--center-content-max));
  margin-left: auto;
  margin-right: auto;
}

.stream-bubble {
  margin-bottom: 0.6rem;
  max-width: min(100%, var(--chat-bubble-max));
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  color: #c5beb2;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 12px;
  line-height: 1.4;
}

.stream-bubble--user {
  background: var(--panel-card);
  border-color: var(--border);
}

.stream-bubble--agent {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0.35rem 0;
  max-width: 100%;
  color: #d0c8ba;
  line-height: 1.55;
}

/* Typewriter blinking caret */
.typewriter-caret {
  display: inline-block;
  width: 2px;
  height: 13px;
  margin-left: 1px;
  vertical-align: -2px;
  background: var(--text);
  animation: caretBlink 0.8s step-end infinite;
}

/* Thinking indicator with shimmer */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.55rem 0 0.6rem;
  font-size: 13px;
  color: var(--text-dim);
}

.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--text-dim) 0%,
    #d5cdbf 40%,
    var(--text-dim) 80%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerSlide 1.6s ease-in-out infinite;
}

@keyframes shimmerSlide {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Phase reveal animation (for progressive plan card population) */
.phase-item--reveal-hidden {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.phase-item--reveal {
  animation: phaseRevealIn 380ms ease-out forwards;
}

@keyframes phaseRevealIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stream-status {
  margin: 0.4rem 0;
  font-size: 11px;
  color: var(--text-dim);
}

.terminal-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: #b4ac9f;
  margin-bottom: 0.22rem;
}

.terminal-line strong {
  color: #ded7ca;
  font-weight: 500;
}

.code-diff {
  margin-top: 0.65rem;
  border: 1px solid #2e5237;
  background: linear-gradient(180deg, rgba(63, 144, 83, 0.15), rgba(28, 66, 39, 0.45));
  border-radius: 8px;
  overflow: hidden;
}

.code-diff__header {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.55rem;
  font-size: 11px;
  color: #aad0b1;
  border-bottom: 1px solid rgba(96, 172, 115, 0.3);
}

.code-diff__lines {
  margin: 0;
  list-style: none;
  padding: 0.45rem 0.55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: #d0ead5;
  line-height: 1.5;
}

.thread-composer {
  width: min(var(--center-content-max), calc(100% - (var(--thread-side-padding) * 2)));
  margin: 0.7rem auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.thread-composer textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: #d3cdbf;
  padding: 0.5rem 0.65rem 0.32rem;
  min-height: 38px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.35;
}

.thread-composer textarea::placeholder {
  color: #8e8578;
  letter-spacing: normal;
}

.thread-composer textarea {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.thread-composer textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.thread-composer__footer {
  padding: 0.08rem 0.65rem 0.46rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.thread-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.model-chip {
  font-size: 10px;
  color: var(--grind-orange-strong);
  border: 1px solid rgba(var(--grind-orange-rgb), 0.35);
  background: rgba(var(--grind-orange-rgb), 0.1);
  border-radius: 999px;
  padding: 0.2rem 0.42rem;
}

.model-chip--plain {
  border: 0;
  background: transparent;
  color: #bdb4a6;
  padding: 0;
  font-size: 12px;
}

.mode-chip {
  border: 1px solid rgba(var(--grind-orange-rgb), 0.35);
  border-radius: 999px;
  background: rgba(var(--grind-orange-rgb), 0.14);
  color: var(--grind-orange-strong);
  font-size: 11px;
  padding: 0.16rem 0.54rem;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  line-height: 1;
}

.mode-chip__icon {
  width: 11px;
  height: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mode-chip__icon svg {
  width: 11px;
  height: 11px;
  display: block;
}

.mode-chip__caret {
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
}

.mode-chip__caret svg {
  width: 10px;
  height: 10px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thread-tools {
  display: flex;
  align-items: center;
  gap: 0.36rem;
}

.tool-icon {
  width: 21px;
  height: 21px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #968e81;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.build-button {
  border: 1px solid rgba(var(--primary-rgb), 0.5);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.16);
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 400;
  padding: 0.2rem 0.68rem;
  cursor: pointer;
  transition: 160ms ease;
}

.build-button:hover {
  background: rgba(var(--primary-rgb), 0.24);
}

.build-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.icon-send {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: #4a453e;
  color: #201d19;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-send svg {
  width: 14px;
  height: 14px;
}

.pane--right {
  background: var(--panel);
  display: grid;
  grid-template-rows: 34px 1fr;
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
  transition: opacity 280ms ease, transform 280ms ease;
}

.studio-body.has-right-pane .pane--right {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.doc-tabs {
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.5rem;
}

.doc-tab {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  padding: 0.35rem 0.45rem;
  border-radius: 5px;
}

.doc-tab--active {
  color: #ece7dd;
  background: var(--panel-elev);
}

.plan-doc {
  overflow: auto;
  padding: 0.8rem 0.85rem 1.2rem;
}

.progress-doc {
  overflow: auto;
  padding: 0.65rem 0.75rem 1.2rem;
}

.is-hidden {
  display: none !important;
}

/* Themed, non-native looking scrollbar for all scrollable panes. */
.task-list,
.thread-stream,
.plan-doc,
.progress-doc,
.build-stream-card__body {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.task-list::-webkit-scrollbar,
.thread-stream::-webkit-scrollbar,
.plan-doc::-webkit-scrollbar,
.progress-doc::-webkit-scrollbar,
.build-stream-card__body::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

.task-list::-webkit-scrollbar-track,
.thread-stream::-webkit-scrollbar-track,
.plan-doc::-webkit-scrollbar-track,
.progress-doc::-webkit-scrollbar-track,
.build-stream-card__body::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

.task-list::-webkit-scrollbar-thumb,
.thread-stream::-webkit-scrollbar-thumb,
.plan-doc::-webkit-scrollbar-thumb,
.progress-doc::-webkit-scrollbar-thumb,
.build-stream-card__body::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

.task-list::-webkit-scrollbar-thumb:hover,
.thread-stream::-webkit-scrollbar-thumb:hover,
.plan-doc::-webkit-scrollbar-thumb:hover,
.progress-doc::-webkit-scrollbar-thumb:hover,
.build-stream-card__body::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.plan-doc h2,
.plan-doc h3,
.progress-doc h2,
.progress-doc h3 {
  margin: 0.65rem 0 0.35rem;
  color: #d5d5d9;
  font-weight: 500;
}

.plan-doc h2,
.progress-doc h2 {
  font-size: 12px;
}

.plan-doc h3,
.progress-doc h3 {
  font-size: 11px;
}

.plan-doc ul {
  margin: 0;
  padding-left: 1rem;
  color: #a6a6ab;
}

.plan-doc li {
  margin: 0.25rem 0;
  font-size: 11px;
  line-height: 1.4;
}

.doc-subtitle {
  margin: 0 0 0.7rem;
  color: var(--text-dim);
  font-size: 11px;
}

.plan-doc h1 {
  margin: 0 0 0.85rem;
  font-size: 15px;
  line-height: 1.3;
  color: #f1ece3;
}

.plan-doc h2 {
  margin: 0.95rem 0 0.45rem;
  font-size: 13px;
  color: #ece7dc;
}

.plan-doc h3 {
  margin: 0.85rem 0 0.35rem;
  font-size: 12px;
  color: #ece7dc;
}

.plan-doc p {
  margin: 0 0 0.65rem;
  color: #c8c0b4;
  font-size: 12px;
  line-height: 1.55;
}

.plan-intro {
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}

.plan-number-list {
  margin: 0 0 0.75rem 0;
  padding-left: 1.15rem;
}

.plan-number-list li {
  margin: 0.32rem 0;
  color: #d2cabc;
  font-size: 12px;
  line-height: 1.45;
}

.plan-phase {
  margin-top: 0.85rem;
  border-radius: 0;
  padding: 0.22rem 0 0.28rem;
  transition: background-color 150ms ease;
}

.plan-phase--flash {
  margin-left: -0.85rem;
  margin-right: -0.85rem;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
  animation: planPhaseFlash 2.2s ease-out;
}

.plan-phase__tasks-title {
  margin: 0.3rem 0 0.3rem;
  color: #d7cebf;
  font-size: 12px;
  font-weight: 500;
}

.plan-phase__tasks {
  margin: 0;
  padding-left: 1.15rem;
}

.plan-phase__tasks > li {
  margin: 0.4rem 0;
  color: #d5cdbf;
  font-size: 12px;
  line-height: 1.45;
}

.plan-subtasks {
  margin: 0.25rem 0 0;
  padding-left: 1.05rem;
}

.plan-subtasks li {
  margin: 0.24rem 0;
  color: #c5bdaf;
  font-size: 12px;
  line-height: 1.42;
}

.inline-code-chip {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--panel-card);
  border-radius: 4px;
  padding: 0.05rem 0.28rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: #e0d7c8;
}

.plan-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.85rem 0 0.55rem;
}

.center-plan-card {
  border: 1px solid var(--border);
  background: var(--panel-card);
  border-radius: 10px;
  padding: 0.7rem 0.75rem 0.45rem;
  margin-bottom: 0.65rem;
}

.center-plan-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 12px;
  color: #dddddf;
}

.center-plan-summary {
  margin: 0 0 0.62rem;
  font-size: 12px;
  color: #c6beb1;
  line-height: 1.5;
}

.center-plan-card__footer {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  display: flex;
  justify-content: flex-end;
}

.center-plan-card__footer.is-hidden {
  display: none !important;
  margin: 0;
  padding: 0;
}

.plan-chip {
  border: 1px solid rgba(var(--grind-orange-rgb), 0.35);
  background: rgba(var(--grind-orange-rgb), 0.12);
  color: var(--grind-orange-strong);
  border-radius: 999px;
  font-size: 10px;
  padding: 0.15rem 0.4rem;
}

.phase-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.phase-item {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.5rem;
}

.phase-item--clickable {
  cursor: pointer;
}

.phase-item--clickable:hover {
  border-color: rgba(var(--grind-orange-rgb), 0.34);
  background: rgba(var(--grind-orange-rgb), 0.06);
}

.phase-item__index {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #3a3a3f;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #aaaaaf;
  margin-top: 1px;
}

.phase-item__title {
  font-size: 12px;
  color: #dfdfe2;
}

.phase-item__desc {
  margin-top: 0.1rem;
  font-size: 11px;
  color: #8f8f95;
}

.phase-item__eta {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.phase-item__meta-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.22rem;
  min-width: 44px;
}

.phase-item__changes {
  transform: scale(0.95);
  transform-origin: right center;
}

.phase-item--active {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.phase-item--summary-card {
  margin-top: 0.1rem;
}

.phase-item--summary-card .phase-item__title {
  font-weight: 600;
}

.phase-item--done.phase-item--summary-card .phase-item__index {
  border-color: rgba(var(--primary-rgb), 0.75);
  background: #2c1f14;
  color: var(--primary-strong);
}

.progress-item--done.progress-item--summary .progress-item__node {
  border: 1.5px solid rgba(var(--primary-rgb), 0.72);
  background: #2c1f14;
  color: var(--primary-strong);
}

.phase-item--active .phase-item__index {
  border-color: rgba(var(--primary-rgb), 0.7);
  color: var(--primary-strong);
}

.phase-item--done .phase-item__index {
  border-color: rgba(var(--primary-rgb), 0.75);
  background: rgba(var(--primary-rgb), 0.2);
  color: var(--primary-strong);
}

.build-stream-card {
  border: 1px solid var(--border);
  background: var(--panel-editor);
  border-radius: 10px;
  overflow: hidden;
}

.build-stream-card__header {
  height: 28px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.6rem;
  font-size: 11px;
  color: #a9a9af;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.7);
  animation: pulseDot 1.25s ease-out infinite;
}

.build-stream-card__body {
  max-height: 260px;
  overflow: auto;
  padding: 0.55rem 0.6rem 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.build-stream-card__body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.build-log-line {
  color: #a7a7ae;
  margin-bottom: 0.25rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.build-log-line--phase {
  color: #d8d8de;
}

.build-log-line--code {
  color: #8edba2;
}

.build-log-line--git {
  color: #cfb06f;
}

.build-log-line--new {
  animation: slideFadeIn 220ms ease both;
}

.build-log-line--typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 12px;
  margin-left: 0.25rem;
  vertical-align: -1px;
  background: #d4d4d8;
  animation: caretBlink 0.8s step-end infinite;
}

.phase-list--doc .phase-item {
  background: var(--panel-editor);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.progress-header p {
  margin: 0.2rem 0 0;
  color: var(--text-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.progress-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.progress-timeline::before {
  display: none;
}

.progress-item {
  position: relative;
  padding-left: 1.9rem;
  padding-bottom: 0.8rem;
}

.progress-item::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 21px;
  bottom: -8px;
  width: 0;
  border-left: 1px dashed #4a4339;
  opacity: 1;
  z-index: 0;
}

.progress-item:last-child {
  padding-bottom: 0.1rem;
}

.progress-item:last-child::after {
  display: none;
}

.progress-item__node {
  position: absolute;
  left: 1px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #3b3b40;
  background: var(--panel-editor);
  color: #8d8d93;
  display: grid;
  place-items: center;
  font-size: 9px;
  overflow: visible;
  z-index: 2;
}

.progress-item__node::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  border-top-color: rgba(var(--primary-rgb), 0.82);
  border-right-color: rgba(var(--primary-rgb), 0.82);
  opacity: 0;
}

.progress-item__title {
  font-size: 12px;
  color: #dbdbdf;
}

.progress-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.08rem 0.38rem;
  background: rgba(255, 255, 255, 0.02);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-diff-plus {
  color: #67ba72;
}

.progress-diff-minus {
  color: #c66b6b;
}

.progress-item__meta {
  margin-top: 0.1rem;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.progress-item__meta--secondary {
  margin-top: 0.24rem;
  color: #b7ae9f;
}

.progress-subtasks {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.24rem;
}

.progress-subtask {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  color: #bdb4a6;
}

.progress-check {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--grind-orange-rgb), 0.55);
  background: transparent;
  flex-shrink: 0;
  position: relative;
}

.progress-check.is-checked {
  border-color: rgba(var(--grind-orange-rgb), 0.85);
  background: rgba(var(--grind-orange-rgb), 0.2);
}

.progress-check.is-checked::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  background: var(--grind-orange-strong);
}

.progress-item--active .progress-item__node {
  border-color: transparent;
  color: var(--primary-strong);
}

.progress-item--active .progress-item__node::before {
  opacity: 1;
  animation: spinRing 1.1s linear infinite;
}

.progress-item--active .progress-item__title {
  color: #f3dfbf;
}

.progress-item--done .progress-item__node {
  border: 1.5px solid rgba(var(--primary-rgb), 0.72);
  background: #2c1f14;
  color: #ff945f;
}

.progress-item--done .progress-item__node::before {
  opacity: 0;
}

.progress-item--done::after {
  border-left-style: solid;
  border-left-color: rgba(var(--primary-rgb), 0.85);
}

.progress-item--summary .progress-item__title {
  font-weight: 600;
}

.progress-item--summary .progress-subtasks {
  display: none;
}

.progress-footer {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.progress-footer p {
  margin: 0.2rem 0 0;
  font-size: 11px;
  color: #b0b0b5;
}

.text-positive {
  color: var(--positive);
}

.text-negative {
  color: var(--negative);
}

@keyframes pulseDot {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.6);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(var(--primary-rgb), 0);
  }
}

@keyframes caretBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes slideFadeIn {
  from {
    transform: translateY(3px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes spinRing {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes planPhaseFlash {
  0% {
    background: rgba(var(--grind-orange-rgb), 0.15);
  }
  100% {
    background: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .phase-item--active .phase-item__index,
  .progress-item--active .progress-item__node::before,
  .live-dot,
  .build-log-line--new,
  .build-log-line--typing::after {
    animation: none !important;
  }
}

@media (max-width: 1200px) {
  .mobile-subbar {
    display: flex;
  }

  .studio-body {
    grid-template-columns: 1fr;
    height: calc(100% - 30px - 50px);
  }

  .pane--center {
    border-right: 0;
  }

  .mobile-left-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.52);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    z-index: 25;
    display: block;
  }

  .mobile-left-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  .pane--left {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(84vw, 290px);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    opacity: 1;
    pointer-events: none;
    z-index: 30;
    transition: transform 240ms ease;
  }

  .studio-body.mobile-left-open .pane--left {
    transform: translateX(0);
    pointer-events: auto;
  }

  .pane--right {
    position: absolute;
    inset: 0;
    z-index: 20;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    border-left: 0;
    grid-template-rows: 1fr;
  }

  .pane--right .doc-tabs {
    display: none;
  }
}

@media (max-width: 860px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .studio-shell {
    padding: 0;
    place-items: stretch;
    min-height: 100dvh;
  }

  .studio-window {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    display: grid;
    grid-template-rows: 38px 50px minmax(0, 1fr);
    overflow: hidden;
  }

  .studio-header {
    grid-template-columns: auto 1fr auto;
    height: 38px;
  }

  .studio-header__center {
    display: none;
  }

  .studio-body {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .pane--center {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
    overflow: hidden;
  }

  .thread-title,
  .thread-subtitle,
  .thread-stream {
    width: calc(100% - 1rem);
  }

  .thread-stream {
    min-height: 0;
    padding-bottom: 0.5rem;
  }

  .thread-composer {
    width: calc(100% - 1rem);
    margin: 0 auto calc(0.45rem + env(safe-area-inset-bottom, 0px));
    border-radius: 12px;
    align-self: end;
  }

  .thread-composer textarea {
    min-height: 44px;
    padding: 0.62rem 0.8rem 0.42rem;
  }

  .thread-composer__footer {
    padding: 0.18rem 0.8rem 0.6rem;
  }

}
