.spec-dialog {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.spec-dialog.hidden {
  display: none;
}

.spec-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: auto;
  transition: opacity 0.16s ease;
}

.spec-dialog.open .spec-dialog-backdrop {
  opacity: 1;
}

[data-theme="dark"] .spec-dialog-backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.spec-dialog-panel {
  position: relative;
  width: min(26rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 2rem));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(0.4rem) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.spec-dialog.open .spec-dialog-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.spec-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.spec-dialog-title {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.spec-dialog-subtitle {
  margin-top: 0.24rem;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.3;
}

.spec-dialog-body {
  min-height: 0;
  overflow: auto;
  padding: 0.85rem;
}

.spec-dialog-message {
  margin-bottom: 0.72rem;
  color: #64748b;
  font: 650 0.78rem/1.4 "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  overflow-wrap: anywhere;
}

.spec-dialog-message.danger {
  color: #b91c1c;
}

.spec-dialog-field {
  display: grid;
  gap: 0.35rem;
  color: #475569;
  font: 760 0.72rem/1 "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

.spec-dialog-field input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  padding: 0.52rem 0.58rem;
  font: 650 0.82rem/1.2 "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

.spec-dialog-field input:focus {
  border-color: #60a5fa;
  outline: 3px solid rgba(96, 165, 250, 0.25);
}

.spec-folder-picker {
  display: grid;
  gap: 0.18rem;
  max-height: 17rem;
  overflow: auto;
}

.spec-folder-option {
  width: 100%;
  border: 0;
  display: flex;
  align-items: center;
  gap: 0.48rem;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  cursor: pointer;
  padding: 0.46rem 0.5rem;
  text-align: left;
  font: 680 0.78rem/1.25 "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

.spec-folder-option:hover,
.spec-folder-option:focus-visible {
  background: #e2e8f0;
  outline: none;
}

.spec-folder-option.selected {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 780;
}

.spec-folder-icon {
  width: 0.92rem;
  height: 0.92rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spec-folder-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spec-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.72rem 0.8rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.spec-dialog-button {
  min-width: 4.8rem;
  height: 2rem;
  border-radius: 6px;
  cursor: pointer;
  padding: 0 0.72rem;
  font: 800 0.74rem/1 "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

.spec-dialog-button.secondary {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
}

.spec-dialog-button.primary {
  border: 1px solid #1d4ed8;
  background: #1d4ed8;
  color: #ffffff;
}

.spec-dialog-button.primary.danger {
  border-color: #b91c1c;
  background: #b91c1c;
}

.spec-dialog-button:hover,
.spec-dialog-button:focus-visible {
  outline: none;
  filter: brightness(1.04);
}


.studio-ai-button .app-icon {
  color: #a78bfa;
}
.studio-ai-button:hover .app-icon,
.studio-ai-button:focus-visible .app-icon {
  color: #c4b5fd;
}

.studio-panel-action.studio-ai-action {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.studio-panel-action.studio-ai-action:hover,
.studio-panel-action.studio-ai-action:focus-visible {
  background: rgba(124, 58, 237, 0.08);
  filter: none;
}
.studio-panel-action.studio-ai-action:disabled {
  cursor: default;
  opacity: 0.38;
}
.studio-panel-action.studio-ai-action:disabled:hover {
  background: transparent;
}
.studio-ai-action > span {
  background: linear-gradient(120deg, #2563eb 0%, #6d28d9 50%, #b45309 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.studio-ai-action > span:first-child {
  font-size: 1.22em;
  line-height: 0.8;
}

[data-theme="dark"] .studio-ai-action > span {
  background: linear-gradient(120deg, #7aa2d6 0%, #b89ce8 50%, #f0b567 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .studio-ai-action > span {
    background: linear-gradient(120deg, #7aa2d6 0%, #b89ce8 50%, #f0b567 100%);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

/* The Studio header remains dark in both document themes. */
:root .toolbar-project-action.studio-ai-action > span {
  background: linear-gradient(120deg, #7aa2d6 0%, #b89ce8 50%, #f0b567 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.studio-ai-quota {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: -4px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  text-decoration: none;
  line-height: 1.4;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.studio-ai-quota:hover,
.studio-ai-quota:focus-visible {
  background: rgba(148, 163, 184, 0.16);
  color: #334155;
  outline: none;
}
.studio-ai-quota.hidden { display: none; }
.studio-ai-quota.studio-ai-quota-granted {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
}
.studio-ai-quota.studio-ai-quota-warn {
  border-color: rgba(217, 119, 6, 0.45);
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}
.studio-ai-quota.studio-ai-quota-exhausted {
  border-color: rgba(185, 28, 28, 0.55);
  background: rgba(185, 28, 28, 0.14);
  color: #b91c1c;
}

body.theme-dark .studio-ai-quota,
[data-theme="dark"] .studio-ai-quota {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.10);
  color: #94a3b8;
}
body.theme-dark .studio-ai-quota:hover,
body.theme-dark .studio-ai-quota:focus-visible,
[data-theme="dark"] .studio-ai-quota:hover,
[data-theme="dark"] .studio-ai-quota:focus-visible {
  background: rgba(148, 163, 184, 0.20);
  color: #e2e8f0;
}
body.theme-dark .studio-ai-quota.studio-ai-quota-granted,
[data-theme="dark"] .studio-ai-quota.studio-ai-quota-granted {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}
body.theme-dark .studio-ai-quota.studio-ai-quota-warn,
[data-theme="dark"] .studio-ai-quota.studio-ai-quota-warn {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}
body.theme-dark .studio-ai-quota.studio-ai-quota-exhausted,
[data-theme="dark"] .studio-ai-quota.studio-ai-quota-exhausted {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
}

.ai-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ai-dialog.hidden { display: none; }

.ai-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: auto;
  transition: opacity 0.16s ease;
}
.ai-dialog.open .ai-dialog-backdrop { opacity: 1; }

[data-theme="dark"] .ai-dialog-backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.ai-dialog-panel {
  position: relative;
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(0.4rem) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.ai-dialog.open .ai-dialog-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ai-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.ai-dialog-header-title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.ai-dialog-badge {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.ai-dialog-badge .app-icon {
  width: 1.15rem;
  height: 1.15rem;
}
.ai-dialog-title {
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.1;
}
.ai-dialog-subtitle {
  margin-top: 0.15rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ai-dialog-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: auto;
}
.ai-dialog-body p {
  margin: 0;
  color: #334155;
  font-size: 0.85rem;
  line-height: 1.5;
}
.ai-dialog-body p strong { color: #1e293b; }
.ai-dialog-note {
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569 !important;
  font-size: 0.78rem !important;
}
.ai-dialog-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.ai-dialog-actions .spec-dialog-button {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  height: 2.2rem;
  padding: 0 0.85rem;
  text-decoration: none;
}
.ai-dialog-actions .spec-dialog-button.primary {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.28);
}
.ai-dialog-status {
  min-height: 1rem;
  color: #059669;
  font-size: 0.78rem;
  font-weight: 700;
}
.ai-dialog-status.error { color: #b91c1c; }

[data-theme="dark"] .ai-dialog-panel {
  background: #1f2229;
  border-color: #3a404c;
}
[data-theme="dark"] .ai-dialog-header {
  background: #1f2229;
  border-bottom-color: #3a404c;
}
[data-theme="dark"] .ai-dialog-title { color: #d7dce4; }
[data-theme="dark"] .ai-dialog-subtitle { color: #9aa5b5; }
[data-theme="dark"] .ai-dialog-body p { color: #d7dce4; }
[data-theme="dark"] .ai-dialog-body p strong { color: #f1f5f9; }
[data-theme="dark"] .ai-dialog-note {
  background: #171a21;
  color: #9aa5b5 !important;
}
[data-theme="dark"] .ai-dialog-actions .spec-dialog-button.secondary {
  background: #171a21;
  border-color: #3a404c;
  color: #d7dce4;
}

.new-project-form { display: flex; flex-direction: column; gap: 0.85rem; }
.ai-project-message {
  white-space: pre-wrap;
  color: var(--color-fg-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}
.new-project-quota-row { display: flex; justify-content: flex-end; margin-top: -0.35rem; }

.refine-diff-body { display: flex; flex-direction: column; gap: 0.6rem; min-width: min(92vw, 1180px); }
.refine-diff-message {
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #475569;
  font-size: 0.85rem;
  line-height: 1.45;
}
[data-theme="dark"] .refine-diff-message {
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}
.refine-diff-summary {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.refine-diff-summary code {
  font-family: var(--font-mono);
  background: rgba(148, 163, 184, 0.14);
  padding: 1px 6px;
  border-radius: 4px;
  color: #334155;
}
[data-theme="dark"] .refine-diff-summary { color: #94a3b8; }
[data-theme="dark"] .refine-diff-summary code { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.refine-diff-add { color: #16a34a; font-weight: 600; }
.refine-diff-del { color: #dc2626; font-weight: 600; }
[data-theme="dark"] .refine-diff-add { color: #4ade80; }
[data-theme="dark"] .refine-diff-del { color: #f87171; }

.refine-diff-pane {
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 6px;
  background: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  max-height: 60vh;
  overflow: auto;
}
[data-theme="dark"] .refine-diff-pane {
  border-color: rgba(148, 163, 184, 0.22);
  background: #0f172a;
}

.refine-diff-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f7;
  border-bottom: 1px solid rgba(148, 163, 184, 0.32);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}
[data-theme="dark"] .refine-diff-header {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.22);
  color: #94a3b8;
}
.refine-diff-header-cell {
  padding: 0.4rem 0.75rem;
}
.refine-diff-header-cell + .refine-diff-header-cell {
  border-left: 1px solid rgba(148, 163, 184, 0.32);
}
[data-theme="dark"] .refine-diff-header-cell + .refine-diff-header-cell {
  border-left-color: rgba(148, 163, 184, 0.22);
}

.refine-diff-rows {
  display: flex;
  flex-direction: column;
}
.refine-diff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 1.5em;
}
.refine-diff-row:has(.refine-diff-skip) {
  grid-template-columns: 1fr;
}
.refine-diff-line {
  padding: 0 0.75rem;
  white-space: pre;
  overflow-x: auto;
  font-weight: 400;
}
.refine-diff-side + .refine-diff-side {
  border-left: 1px solid rgba(148, 163, 184, 0.28);
}
[data-theme="dark"] .refine-diff-side + .refine-diff-side {
  border-left-color: rgba(148, 163, 184, 0.18);
}
.refine-diff-line.refine-diff-add {
  background: rgba(22, 163, 74, 0.14);
  color: #14532d;
}
.refine-diff-line.refine-diff-del {
  background: rgba(220, 38, 38, 0.12);
  color: #7f1d1d;
}
.refine-diff-line.refine-diff-empty {
  background: rgba(148, 163, 184, 0.05);
}
.refine-diff-line.refine-diff-ctx {
  color: #475569;
}
.refine-diff-line.refine-diff-skip {
  color: #94a3b8;
  font-style: italic;
  background: rgba(148, 163, 184, 0.08);
  border-top: 1px dashed rgba(148, 163, 184, 0.3);
  border-bottom: 1px dashed rgba(148, 163, 184, 0.3);
  margin: 2px 0;
  text-align: center;
  padding: 2px 0;
  font-family: system-ui, -apple-system, sans-serif;
}
[data-theme="dark"] .refine-diff-line.refine-diff-add {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}
[data-theme="dark"] .refine-diff-line.refine-diff-del {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}
[data-theme="dark"] .refine-diff-line.refine-diff-empty {
  background: rgba(148, 163, 184, 0.06);
}
[data-theme="dark"] .refine-diff-line.refine-diff-ctx {
  color: #94a3b8;
}
[data-theme="dark"] .refine-diff-line.refine-diff-skip {
  color: #64748b;
  background: rgba(148, 163, 184, 0.06);
  border-color: rgba(148, 163, 184, 0.2);
}

.refine-context-info {
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: #1e3a8a;
  font-size: 0.82rem;
  line-height: 1.5;
}
.refine-context-info code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(59, 130, 246, 0.14);
  padding: 1px 5px;
  border-radius: 4px;
  color: #1e3a8a;
}
[data-theme="dark"] .refine-context-info {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.28);
  color: #bfdbfe;
}
[data-theme="dark"] .refine-context-info code {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}
.new-project-notes-error {
  border-color: #dc2626 !important;
  animation: new-project-shake 0.32s ease;
}
@keyframes new-project-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

.spec-dialog-button.new-project-confirm-ai {
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  border-color: transparent;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05), 0 4px 14px rgba(124, 58, 237, 0.25);
}
.spec-dialog-button.new-project-confirm-ai:hover,
.spec-dialog-button.new-project-confirm-ai:focus-visible {
  filter: brightness(1.06);
}
.new-project-confirm-sparkle {
  display: inline-block;
  font-size: 0.95em;
  animation: new-project-sparkle-pulse 2.4s ease-in-out infinite;
}
@keyframes new-project-sparkle-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%      { transform: scale(1.18); opacity: 1; }
}
.new-project-mode { display: flex; flex-direction: column; gap: 0.35rem; }
.new-project-mode-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #64748b;
}
.new-project-mode-option {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0; font-size: 0.9rem; color: #1f2937; cursor: pointer;
}
.new-project-mode-option input[type="radio"] { accent-color: #2563eb; }
.new-project-ai { display: flex; flex-direction: column; gap: 0.75rem; }
.new-project-ai.hidden { display: none; }
.new-project-ai-field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: #1f2937; }
.new-project-ai-field span {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #64748b;
}
.new-project-select,
.new-project-ai-field textarea {
  border: 1px solid #cbd5e1; border-radius: 6px; padding: 0.5rem 0.65rem;
  font: inherit; font-size: 0.9rem; color: #1f2937; background: #ffffff;
}
.new-project-ai-field textarea { resize: vertical; min-height: 90px; font-family: var(--font-mono); }
.new-project-ai-field textarea.new-project-sample { min-height: 200px; }
.new-project-ai-field textarea.new-project-notes { min-height: 90px; font-family: inherit; }
.new-project-example { display: flex; flex-direction: column; gap: 0.6rem; }
.new-project-example.hidden { display: none; }
.new-project-example-description {
  color: #64748b; font-size: 0.8rem; line-height: 1.45; padding: 0 0.15rem; min-height: 1rem;
}
[data-theme="dark"] .new-project-example-description { color: #9aa5b5; }

.new-project-starters {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.new-project-starter {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.new-project-starter:hover,
.new-project-starter:focus-visible {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1d4ed8;
  outline: none;
}
.new-project-starter-empty {
  border-style: dashed;
  color: #64748b;
}
.new-project-starter-empty:hover,
.new-project-starter-empty:focus-visible {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #334155;
}
[data-theme="dark"] .new-project-starter {
  background: #171a21;
  border-color: #3a404c;
  color: #d7dce4;
}
[data-theme="dark"] .new-project-starter:hover,
[data-theme="dark"] .new-project-starter:focus-visible {
  background: rgba(96, 165, 250, 0.18);
  border-color: #60a5fa;
  color: #93c5fd;
}
[data-theme="dark"] .new-project-starter-empty {
  color: #9aa5b5;
}
[data-theme="dark"] .new-project-starter-empty:hover,
[data-theme="dark"] .new-project-starter-empty:focus-visible {
  background: #1f2229;
  border-color: #5c6472;
  color: #d7dce4;
}
.spec-dialog-panel:has(.new-project-form) {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(44rem, calc(100vh - 2rem));
}
.spec-dialog-panel:has(.refine-diff-body) {
  width: min(80rem, calc(100vw - 2rem));
  max-height: min(48rem, calc(100vh - 2rem));
}
.new-project-select:focus,
.new-project-ai-field textarea:focus {
  outline: 3px solid rgba(96, 165, 250, 0.25);
  border-color: #60a5fa;
}
.new-project-discard { display: flex; flex-direction: column; gap: 0.75rem; align-items: stretch; }
.spec-dialog-inline-danger { align-self: flex-start; color: #b91c1c; border-color: #fecaca; background: #fef2f2; }

.studio-busy-overlay {
  position: fixed; inset: 0; background: rgba(248, 250, 252, 0.65);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s ease; z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.studio-busy-overlay.open { opacity: 1; }

[data-theme="dark"] .studio-busy-overlay {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.studio-busy-trace {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: min(32rem, calc(100vw - 2.5rem));
  max-height: calc(100vh - 2.5rem);
  max-height: calc(100dvh - 2.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.15rem;
  pointer-events: none;
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(71, 85, 105, 0.55);
  text-align: right;
  z-index: 1001;
  user-select: none;
}
[data-theme="dark"] .studio-busy-trace {
  color: rgba(215, 220, 228, 0.35);
}
.studio-busy-trace-line {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.studio-busy-trace-line.visible {
  opacity: 1;
  transform: translateY(0);
}
.studio-busy-trace-line:first-child {
  opacity: 0.35;
}
.studio-busy-trace-line:nth-child(2) {
  opacity: 0.55;
}
.studio-busy-trace-line:last-child {
  opacity: 1;
}
.studio-busy-trace-line.real {
  color: rgba(59, 130, 246, 0.7);
}
[data-theme="dark"] .studio-busy-trace-line.real {
  color: rgba(147, 197, 253, 0.7);
}
.studio-busy-trace-line.error {
  color: rgba(220, 38, 38, 0.82);
}
[data-theme="dark"] .studio-busy-trace-line.error {
  color: rgba(252, 165, 165, 0.88);
}
.studio-busy-card {
  background: #ffffff; border: 1px solid #cbd5e1; border-radius: 10px; padding: 1.5rem 2rem;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.28);
  display: flex; flex-direction: column; align-items: center; gap: 0.85rem; min-width: 220px;
}
.studio-busy-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid #e2e8f0; border-top-color: #2563eb;
  animation: studio-busy-spin 0.8s linear infinite;
}
.studio-busy-label { font-size: 0.9rem; color: #334155; font-weight: 650; }
@keyframes studio-busy-spin { to { transform: rotate(360deg); } }

[data-theme="dark"] .new-project-mode-label,
[data-theme="dark"] .new-project-ai-field span {
  color: #9aa5b5;
}
[data-theme="dark"] .new-project-mode-option,
[data-theme="dark"] .new-project-ai-field {
  color: #d7dce4;
}
[data-theme="dark"] .new-project-select,
[data-theme="dark"] .new-project-ai-field textarea {
  background: #171a21;
  border-color: #3a404c;
  color: #d7dce4;
}
[data-theme="dark"] .new-project-select:focus,
[data-theme="dark"] .new-project-ai-field textarea:focus {
  border-color: #60a5fa;
  outline: 3px solid rgba(96, 165, 250, 0.28);
}
[data-theme="dark"] .spec-dialog-inline-danger {
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(127, 29, 29, 0.28);
}
[data-theme="dark"] .studio-busy-card {
  background: #1f2229;
  border-color: #3a404c;
}
[data-theme="dark"] .studio-busy-label { color: #d7dce4; }
[data-theme="dark"] .studio-busy-spinner {
  border-color: #3a404c;
  border-top-color: #60a5fa;
}
