@layer views {
:root {
  --rg-sidebar-width: 260px;
}

body.studio-page {
  display: flex;
  grid-template-columns: unset;
  grid-template-rows: unset;
  grid-template-areas: unset;
  position: fixed;
  top: var(--vv-top, 0px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  height: var(--vvh, 100dvh);
  overflow: hidden;
  background: var(--rg-bg);
  color: var(--rg-text);
}
:root[data-theme='dark'] body.studio-page {
  --rg-bg: #05080c;
  --rg-surface: #0b111c;
  --rg-surface-2: #0d1420;
  --rg-line: #232d3a;
  --rg-text: #f2f5f7;
  --rg-muted: #8a97a5;
}
.studio-app {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--rg-bg);
}
.studio-sidebar-col {
  width: var(--rg-sidebar-width);
  flex: 0 0 var(--rg-sidebar-width);
  max-width: var(--rg-sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 8px 0;
  background: var(--rg-bg);
  border-right: 1px solid var(--rg-line);
  overflow: hidden;
}
.sidebar-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 10px 10px;
}
.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--rg-text);
  text-decoration: none;
  font-family: var(--rg-font-display);
  font-variation-settings: 'opsz' 28;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.1px;
  user-select: none;
  cursor: default;
}
.sidebar-brand-badge {
  font-family: var(--rg-font-sans, Inter, ui-sans-serif, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--rg-surface-2);
  border: 1px solid var(--rg-line);
  color: var(--rg-muted);
}
.sidebar-action {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px 8px;
}
.studio-sidebar-col .side-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.sidebar-history-container { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: 10px; }
.sidebar-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  color: var(--rg-text);
  font-size: 13.5px;
  font-weight: 700;
}
.sidebar-history-header .history-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.project-list {
  padding: 4px 10px 12px;
}
#btn-close-sidebar, #btn-clear-history, #btn-close-sheet {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rg-muted);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
#btn-close-sidebar:hover, #btn-clear-history:hover, #btn-close-sheet:hover {
  background: var(--rg-ring);
  color: var(--rg-text);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-bottom: 1px solid var(--rg-line);
}
.nav-item {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--rg-text);
  text-decoration: none;
  font-size: 14px;
}
.nav-item.active,
.nav-item:hover { background: var(--rg-surface-2); }
.sidebar-history-title {
  padding: 12px 14px 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rg-muted);
}
.project-list { flex: 1; min-width: 0; min-height: 0; overflow: auto; padding: 6px 6px 12px; }
.project-empty { margin: 0; padding: 24px 0; text-align: center; color: var(--rg-muted); font-size: 13.5px; }
.sidebar-nav { margin-top: auto; }
#studio-history > button,
.history-title {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 7px 10px;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--rg-text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.history-title:hover {
  background: var(--rg-ring);
}
.history-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.history-row .history-title { flex: 1; }
.history-del {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rg-muted);
  font-size: 18px;
}
.studio-chat-col {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--rg-bg);
  z-index: 2;
}
body.studio-page #topbar.studio-topbar {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  box-sizing: border-box;
  flex-shrink: 0;
  flex-wrap: nowrap;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  overflow: hidden;
  background: var(--rg-surface);
  border-bottom: 1px solid var(--rg-line);
  z-index: 40;
  position: relative;
}
.topbar-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(100% - 112px);
  pointer-events: none;
  gap: 1px;
}
.topbar-title {
  position: static;
  transform: none;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 650;
  text-align: center;
  pointer-events: none;
  background: transparent;
  border: none;
  box-shadow: none;
}
.runtime-pill { font-size: 10px; line-height: 1.2; color: var(--rg-muted); white-space: nowrap; }
.desktop-crumb {
  display: none;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  box-shadow: none;
}
#crumb-project {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--rg-text);
  background: transparent;
  border: none;
  box-shadow: none;
}
#stat-runtime { flex-shrink: 0; color: var(--rg-muted); font-size: 12px; }
.row-spacer { flex: 1; min-width: 8px; }
#btn-toggle-sidebar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  box-shadow: var(--rg-shadow);
  color: var(--rg-text);
}
#btn-new-chat, #btn-toggle-canvas {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 11px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  box-shadow: var(--rg-shadow);
  color: var(--rg-text);
}
.drawer-primary,
.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rg-text);
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: background 0.16s ease;
}
.drawer-primary:hover,
.drawer-nav-link:hover {
  background: var(--rg-ring);
}
#studio-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 89;
  transition: opacity 0.32s;
}
#sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 120;
  opacity: 1;
  pointer-events: auto;
}
#studio-drawer-backdrop[hidden], #sheet-backdrop[hidden] { display: none; }
.studio-content-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.studio-empty-state {
  text-align: center;
  width: min(640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 8px;
}
.studio-welcome-title {
  margin: 0 0 8px;
  font-family: var(--rg-font-display);
  font-size: 28px;
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--rg-text);
}
.studio-welcome-sub { margin: 0 0 18px; color: var(--rg-muted); font-size: 14px; line-height: 1.45; }
.inspiration-cards { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; width: 100%; margin-top: 14px; }
.studio-app.is-active .inspiration-cards,
.studio-app.is-active #empty-state { display: none; }
.insp-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  height: 32px;
  padding: 0 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  color: var(--rg-muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.insp-card svg {
  flex-shrink: 0;
  opacity: 0.72;
}
.insp-card:hover {
  background: var(--rg-surface-2);
  color: var(--rg-text);
  border-color: color-mix(in srgb, var(--rg-text) 22%, var(--rg-line));
  transform: translateY(-1px);
}
.insp-card:hover svg {
  opacity: 1;
}
#btn-studio-send,
#btn-send.send-plain {
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}
#btn-studio-send.is-ready,
#btn-send.is-ready {
  color: var(--rg-bg);
  background: var(--rg-text);
}
.studio-app.is-active #empty-state { display: none; }
body.studio-page .studio-app:not(.is-active) #messages { display: none; }
body.studio-page .studio-app.is-active .studio-content-area { overflow: hidden; }
body.studio-page .studio-app.is-active #messages {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 32px;
  gap: 16px;
}
body.studio-page .msg.user {
  align-self: flex-end;
  width: fit-content;
  max-width: 72%;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  background: var(--rg-surface-2);
  color: var(--rg-text);
  border: 1px solid var(--rg-line);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-left: auto;
  margin-right: 0;
  text-align: left;
  word-break: break-word;
  font-size: 14.5px;
  line-height: 1.5;
}
body.studio-page .msg.user:has(.msg-user-bubble),
body.studio-page .msg.user:has(.msg-attach-list) {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}
body.studio-page .msg.ai {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--rg-text);
}
.tool-trace-actions { display: none; }
body.studio-page #composer {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 100%;
  max-width: none;
  margin-top: auto;
  padding: 0 12px calc(14px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 12;
}
body.studio-page #composer > * {
  pointer-events: auto;
}
body.studio-page #composer-card {
  background: var(--rg-bg-glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(15, 20, 28, 0.08);
  border-radius: 26px;
  padding: 14px 14px 10px;
  box-shadow: 0 8px 28px -6px rgba(15, 20, 28, 0.08), 0 2px 6px rgba(15, 20, 28, 0.03);
  transition: background 0.28s ease, border-color 0.2s, box-shadow 0.2s;
}
body.studio-page #composer-card:has(#chat-input:focus) {
  border-color: var(--rg-line);
  box-shadow: var(--rg-shadow);
  outline: none;
}
body.studio-page #chat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--rg-text);
  font-size: 17px;
  line-height: 1.45;
  padding: 2px 4px;
  resize: none;
  max-height: 120px;
  overflow-y: hidden;
  scrollbar-width: none;
}
body.studio-page #composer .card-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
body.studio-page #composer .row-spacer {
  display: block;
  flex: 1 1 auto;
}
body.studio-page #btn-plus,
body.studio-page #btn-model {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rg-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
body.studio-page #btn-plus:hover,
body.studio-page #btn-model:hover,
body.model-open #btn-model {
  color: var(--rg-text);
  background: var(--rg-surface-2);
}
#studio-attach-sheet,
body.studio-page #model-sheet {
  z-index: 140;
}
#studio-attach-sheet[hidden],
body.studio-page #model-sheet[hidden] { display: none; }
body.studio-page .sheet-dev-connectors {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 0;
  border-top: none;
}
body.studio-page .attach-plain {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  width: 100%;
  margin-top: 0;
  padding: 12px 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--rg-text);
  font-size: 14.2px;
  font-weight: 540;
  text-align: left;
  border: none;
  cursor: pointer;
}
body.studio-page .attach-plain svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--rg-text);
}
body.studio-page .attach-plain .attach-plain-label,
body.studio-page .attach-plain span:first-of-type {
  flex: 1;
  font-weight: 540;
}
.sheet-section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--rg-muted); margin: 6px 4px 0; }
.status-pill { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--rg-surface-2); color: var(--rg-muted); flex: 0 0 auto; }
.status-pill.connected { background: color-mix(in srgb, #15803d 18%, transparent); color: #15803d; }
.status-pill.action { color: var(--rg-accent); }
.studio-turn { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 100%; min-width: 0; }
.studio-action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(100%, 420px);
  margin-top: 4px;
  padding: 10px;
  border: 1px solid var(--rg-line);
  border-radius: 14px;
  background: var(--rg-surface);
}
.chip-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface-2);
  color: var(--rg-text);
}
.studio-canvas-pane {
  min-width: 0;
  min-height: 0;
  display: none;
  flex-direction: column;
  background: var(--rg-surface);
  color: var(--rg-text);
  border-left: 1px solid var(--rg-line);
  container-type: inline-size;
  container-name: kanvas;
}
.canvas-head, .canvas-tabs, .telemetry-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  background: var(--rg-bg);
  border-bottom: 1px solid var(--rg-line);
  flex-shrink: 0;
}
.canvas-head {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  box-sizing: border-box;
}
.canvas-head .canvas-tabs {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  border: 0;
  background: transparent;
  padding: 0;
  height: auto;
  min-height: 0;
}
.canvas-head .canvas-tabs::-webkit-scrollbar { display: none; }
.canvas-head .tab-btn { min-height: 32px; padding: 4px 8px; flex: 0 0 auto; white-space: nowrap; }
.door-pill {
  font-size: 12px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
}
.door-pill[data-door="local"] { color: #9a3412; }
.sandbox-pill { font-size: 12px; color: var(--rg-muted); white-space: nowrap; }
.sandbox-pill strong { color: var(--rg-text); font-weight: 650; }
.connector-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 8px 6px 18px;
  padding: 4px 0 4px 10px;
  border-left: 1.5px solid var(--rg-line);
}
.connector-panel[hidden] { display: none; }
body.studio-page .attach-plain:focus {
  outline: none;
}
body.studio-page .attach-plain:focus-visible {
  outline: 2px solid var(--rg-line-accent);
  outline-offset: -2px;
}
.hub-link { font-size: 13px; color: var(--rg-accent); padding: 6px 8px; }
.gdrive-row, .studio-modal-list button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--rg-text);
  font: inherit;
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.gdrive-row:hover {
  background: var(--rg-surface-2);
}
.gdrive-row.is-on {
  background: var(--rg-surface-2);
  border-color: var(--rg-line);
  font-weight: 600;
}
.studio-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.studio-modal-backdrop[hidden] { display: none; }
.studio-modal-box {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 18px;
  width: min(520px, 92vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 48px -12px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}
.studio-modal-header, .studio-modal-footer {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.studio-modal-header {
  border-bottom: 1px solid var(--rg-line);
  font-weight: 650;
  font-size: 15px;
}
.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.studio-modal-header .sheet-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rg-muted);
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.studio-modal-header .sheet-close:hover {
  background: var(--rg-surface-2);
  color: var(--rg-text);
}
.studio-modal-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--rg-line);
}
.studio-modal-form[hidden] {
  display: none;
}
.modal-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--rg-muted);
  margin-top: 2px;
}
.modal-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.modal-field-row .auth-input {
  flex: 1 1 180px;
  margin: 0;
}
.studio-modal-box .auth-input {
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  color: var(--rg-text);
  font: inherit;
  font-size: 13px;
}
.studio-modal-footer {
  border-top: 1px solid var(--rg-line);
  justify-content: flex-end;
  background: var(--rg-surface);
}
.studio-modal-box .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.studio-modal-box .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.studio-modal-box .btn-secondary {
  background: var(--rg-surface-2);
  color: var(--rg-text);
  border: 1px solid var(--rg-line);
}
.studio-modal-box .btn-secondary:hover:not(:disabled) {
  background: var(--rg-ring);
}
.studio-modal-box .btn-primary {
  background: var(--rg-text);
  color: var(--rg-surface);
  border: 1px solid var(--rg-text);
}
.studio-modal-box .btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}
.studio-modal-box .btn-ghost {
  background: transparent;
  color: var(--rg-muted);
  border: 1px solid transparent;
  padding: 0 10px;
}
.studio-modal-box .btn-ghost:hover {
  color: var(--rg-text);
  background: var(--rg-surface-2);
}
.studio-modal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: var(--rg-surface-2);
  border-bottom: 1px solid var(--rg-line);
  font-size: 12.5px;
  color: var(--rg-muted);
}
.crumb-up-btn {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  color: var(--rg-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.crumb-up-btn:hover {
  background: var(--rg-ring);
}
.studio-modal-list {
  flex: 1;
  overflow: auto;
  padding: 12px 18px;
  min-height: 150px;
}
.studio-modal-list .list-loading {
  color: var(--rg-muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 18px 8px;
  text-align: center;
}
#studio-attach-sheet .attach-plain svg { flex: none; }
.telemetry-bar { font-size: 12px; color: var(--rg-muted); }
.telemetry-bar strong { color: var(--rg-text); font-weight: 650; }
#studio-project-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tab-btn {
  min-height: 36px;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--rg-muted);
  font: inherit;
  cursor: pointer;
}
.tab-btn.active { color: var(--rg-text); background: var(--rg-surface-2); font-weight: 650; }
#studio-sheet-close {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
  background: transparent;
}
.canvas-content { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.tab-panel { display: none; position: absolute; inset: 0; }
.tab-panel.active { display: flex; flex-direction: column; }
#studio-preview-frame { width: 100%; height: 100%; flex: 1; min-height: 0; border: 0; background: #fff; }
.studio-diagnostics {
  padding: 20px 16px;
  color: var(--rg-text);
  overflow: auto;
}
.studio-diagnostics h2 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.studio-diagnostics p { margin: 0 0 12px; color: var(--rg-muted); font-size: 12px; }
.studio-diagnostics ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.studio-diagnostics li { padding: 10px 12px; border: 1px solid var(--rg-line); border-radius: 8px; background: var(--rg-surface); font-size: 13px; }
#btn-collapse-sidebar {
  display: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rg-muted);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
#btn-collapse-sidebar:hover {
  background: var(--rg-ring);
  color: var(--rg-text);
}
.canvas-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.studio-empty-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 32px 24px;
  color: var(--rg-muted);
}
.studio-empty-canvas h3 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--rg-text);
}
.studio-empty-canvas p {
  margin: 0;
  max-width: 36ch;
  font-size: 13px;
  line-height: 1.5;
}
.empty-canvas-icon { color: var(--rg-muted); }
.studio-modal-note {
  margin: 0;
  padding: 16px;
  color: var(--rg-muted);
  font-size: 14px;
  line-height: 1.5;
}
.studio-app.is-active #studio-diagnostics { display: none; }
.studio-app:not(.is-active) #studio-preview-frame { display: none; }
#vfs-tree { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 12px; flex-shrink: 0; }
#vfs-tree button {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  background: transparent;
  color: var(--rg-text);
  cursor: pointer;
}
#vfs-tree button.on {
  background: var(--rg-surface-2);
  border-color: var(--rg-accent);
  font-weight: 650;
}
.code-editor, .console-output {
  flex: 1; margin: 0; min-height: 0; padding: 12px; overflow: auto;
  white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 13px;
}
.code-editor { background: var(--rg-surface); color: var(--rg-text); border-top: 1px solid var(--rg-line); }
.console-output { background: #000; color: #4ade80; }
.terminal-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  background: #05080c;
  border-top: 1px solid #1e293b;
  border-bottom: none;
  border-left: none;
  border-right: none;
  flex-shrink: 0;
}
.terminal-prompt {
  color: #34d399;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 13px;
}
#terminal-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: #f8fafc;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  outline: none;
}
#btn-terminal-run {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.living-doc-shell, .living-sheet-shell {
  white-space: normal;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.55;
}
.living-doc-shell h2, .living-sheet-shell h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 650;
}
.living-doc-diagram {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
}
.living-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 8px;
}
.living-sheet-table th, .living-sheet-table td {
  border: 1px solid var(--rg-line);
  padding: 6px 10px;
  text-align: left;
}
.living-sheet-table th {
  background: var(--rg-surface-2);
  font-weight: 650;
}
.living-sheet-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.living-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.living-bar-fill {
  height: 8px;
  border-radius: 999px;
  background: #2563eb;
}
.diff-line.add { background: rgba(154, 184, 168, 0.16); color: #c9ddd2; }
.diff-line.del { background: rgba(196, 154, 154, 0.16); color: #e4cccc; }
.diff-line { display: grid; grid-template-columns: 3.2ch 3.2ch minmax(0, 1fr); gap: 8px; }
.diff-hunk { color: var(--rg-muted); padding: 4px 0; }
.ln { color: var(--rg-muted); text-align: right; }
.code-editor, .console-output, .tool-trace-card { font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; }
@media (min-width: 1024px) {
  .topbar-center, #btn-close-sidebar { display: none; }
  .studio-topbar .row-spacer { display: block; flex: 1; }
  #btn-toggle-sidebar { display: none; }
  .studio-app.is-sidebar-collapsed #btn-toggle-sidebar { display: inline-flex; }
  #btn-collapse-sidebar, #studio-sheet-close { display: inline-flex; }
  .desktop-crumb { display: none; }
  .studio-app.is-sidebar-collapsed .studio-sidebar-col {
    transform: translateX(-100%);
    width: 0;
    flex-basis: 0;
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right: 0;
    overflow: hidden;
  }
  .studio-app.is-split:not(.is-canvas-hidden) .studio-chat-col {
    flex: 1 1 42%;
    max-width: 44%;
    min-width: 340px;
  }
  body.studio-page #composer {
    width: 100%;
    max-width: 660px;
    margin-left: auto;
    margin-right: auto;
  }
  body.studio-page #studio-attach-sheet,
  body.studio-page #model-sheet {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    width: min(440px, 90vw);
    height: auto;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rg-line) transparent;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.24), 0 0 0 1px var(--rg-line);
    z-index: 140;
    opacity: 1;
  }
  body.studio-page #studio-attach-sheet::-webkit-scrollbar { width: 5px; }
  body.studio-page #studio-attach-sheet::-webkit-scrollbar-thumb {
    background: var(--rg-line);
    border-radius: 5px;
  }
  body.studio-page #sheet-backdrop {
    background: transparent;
  }
  body.studio-page #studio-attach-sheet:not([hidden]),
  body.studio-page #model-sheet:not([hidden]) {
    animation: studio-pop 150ms ease;
  }
  .studio-app.is-split:not(.is-canvas-hidden) .studio-canvas-pane {
    display: flex;
    flex: 1 1 58%;
    min-width: 420px;
    width: auto;
    height: 100%;
  }
  .studio-app:not(.is-active) .studio-content-area {
    justify-content: center;
    align-items: center;
    padding-bottom: 108px;
    overflow: hidden;
  }
  .studio-app:not(.is-active) #composer {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: min(660px, calc(100% - 64px));
    max-width: 660px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
  }
  .studio-app:not(.is-active) #composer-card {
    border-radius: 20px;
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.08);
  }
  .studio-app:not(.is-active) #empty-state {
    order: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin: 0 0 18px;
    padding: 0 16px;
    text-align: center;
  }
  .studio-app:not(.is-active) .studio-welcome-title {
    font-size: 36px;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0 0 6px;
    color: var(--rg-text);
  }
  .studio-app:not(.is-active) #studio-greeting-sub {
    font-size: 14.5px;
    color: var(--rg-muted);
    margin: 0;
    max-width: 540px;
    line-height: 1.45;
  }
  .studio-app:not(.is-active) #composer { order: 2; }
  .studio-app:not(.is-active) .inspiration-cards {
    order: 3;
    display: flex;
    width: min(660px, calc(100% - 64px));
    margin: 16px auto 0;
    justify-content: center;
  }
}
@media (max-width: 1023px) {
  #btn-toggle-canvas { display: inline-flex; }
  .studio-app.is-split .studio-chat-col {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
    min-width: 0;
  }
  .sandbox-pill { display: none; }
  .canvas-head { position: relative; padding-right: 44px; }
  #studio-sheet-close { position: absolute; right: 6px; top: 8px; z-index: 2; }
  body.studio-page #studio-attach-sheet {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: auto;
    max-height: 75vh;
    border-radius: 24px 24px 0 0;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    z-index: 140;
  }
  .studio-sidebar-col {
    display: flex;
    position: fixed;
    z-index: 90;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(310px, 86vw);
    max-width: min(310px, 86vw);
    flex-basis: min(310px, 86vw);
    padding: 12px 12px 0;
    transform: translateX(-105%);
    transition: transform 0.32s cubic-bezier(0.1, 0.9, 0.2, 1);
  }
  .studio-sidebar-col.is-open { transform: none; }
  .studio-chat-body { padding-bottom: calc(104px + env(safe-area-inset-bottom) + var(--kb-inset, 0px)); }
  body.studio-page #composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 12px calc(14px + env(safe-area-inset-bottom, 0px));
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
  }
  body.studio-page #composer > * {
    pointer-events: auto;
  }
  body.studio-page.keyboard-open #composer {
    padding: 0 12px 12px;
  }
  .studio-app .inspiration-cards {
    display: none;
  }
  .studio-app:not(.is-active) .studio-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .studio-canvas-pane {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 86vh;
    z-index: 140;
    transform: translateY(110%);
    pointer-events: none;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    border-top: 1px solid var(--rg-line);
  }
  .studio-canvas-pane.is-sheet-open { transform: none; pointer-events: auto; }
}

.tool-trace-card {
  width: min(100%, 640px);
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, monospace;
  margin: 8px 0 0;
  color: var(--rg-text);
}
.tool-trace-header { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--rg-line); padding-bottom: 8px; margin-bottom: 10px; }
.tool-trace-badge { color: var(--rg-accent); font-size: 12px; font-weight: 700; }
.tool-trace-timestamp { color: var(--rg-muted); font-size: 11px; }
.trace-item { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; min-width: 0; }
.trace-icon { font-weight: 650; padding: 2px 6px; border-radius: 4px; background: var(--rg-surface-2); font-size: 12px; flex: 0 0 auto; }
.trace-grep { color: #f59e0b; }
.trace-read { color: #c4b5fd; }
.trace-edit { color: #93c5fd; }
.trace-verify { color: #34d399; }
.trace-command, .trace-path { color: var(--rg-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-chips { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; font-size: 11px; color: var(--rg-muted); font-variant-numeric: tabular-nums; }

@keyframes studio-pop {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.trace-edit-block { display: block; background: var(--rg-bg); border: 1px solid var(--rg-line); border-radius: 6px; padding: 8px; margin: 8px 0; }
.trace-edit-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.inline-diff-viewer { font-size: 12px; line-height: 1.4; overflow: auto; }
.tool-trace-card .diff-line { display: flex; }
.tool-trace-card .diff-line .ln { width: 28px; color: #475569; user-select: none; text-align: right; padding-right: 8px; flex: 0 0 auto; }
.tool-trace-card .diff-context { color: #94a3b8; }
.tool-trace-card .diff-add { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.tool-trace-card .diff-del { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.trace-status { color: #34d399; font-weight: 650; }
.tool-trace-actions { display: none; }
.tool-trace-actions .btn-action { flex: 1; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 6px; font-weight: 650; font-size: 13px; cursor: pointer; }
.tool-trace-actions .btn-preview { background: #2563eb; color: #fff; }
.tool-trace-actions .btn-download { background: #334155; color: #f8fafc; }

@media (min-width: 1024px) {
  .studio-app.is-focus .studio-canvas-pane { display: none; }
  .studio-app.is-focus .studio-chat-col {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
  }
  .studio-app.is-expanded .studio-chat-col {
    flex: 0 0 20%;
    max-width: 20%;
    min-width: 0;
  }
  .studio-app.is-expanded .studio-canvas-pane {
    flex: 1 1 80%;
    min-width: 0;
  }
}

.hunk-stage { display: flex; gap: 8px; padding: 8px 12px; flex: 0 0 auto; align-items: center; }
.hunk-accept, .hunk-reject {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  color: var(--rg-text);
  cursor: pointer;
}
.hunk-accept[data-decision="accept"] {
  border-color: #16a34a;
  color: #4ade80;
}
.hunk-reject[data-decision="reject"] {
  border-color: #dc2626;
  color: #f87171;
}

@container kanvas (max-width: 699px) {
  .sandbox-pill, .hud-chips { display: none; }
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  align-items: center;
}
.file-actions button,
.file-actions input {
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  color: var(--rg-text);
  padding: 4px 8px;
}
.editor-manual {
  display: grid;
  grid-template-columns: 3ch 1fr;
  gap: 8px;
  min-height: 180px;
}
#code-manual, #code-gutter, #code-highlight {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}
#code-highlight { grid-column: 2; white-space: pre-wrap; }
.tok-key { color: #9ecbff; }
.vfs-tree button.is-dirty::after { content: " ●"; }
.console-error { display: flex; gap: 8px; align-items: center; }
.heal-once { min-height: 32px; }

.preview-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--rg-line);
  background: var(--rg-surface);
}
#btn-inspect-dom {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface-2);
  color: var(--rg-text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
#btn-inspect-dom:hover {
  border-color: var(--rg-muted);
}
#btn-inspect-dom[aria-pressed="true"] {
  background: var(--rg-text);
  color: var(--rg-bg);
  border-color: var(--rg-text);
}
.studio-hud {
  display: none;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 14, 16, 0.92);
  color: #c8c6c0;
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
#tab-logs.active .studio-hud { display: flex; }
@media (max-width: 768px) {
  .studio-hud { display: none; }
}
.preview-tools button { min-height: 32px; }
@media (horizontal-viewport-segments: 2) {
  #studio-app.is-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

#tab-files,
#tab-dokumen,
#tab-sheet {
  background: var(--rg-bg);
}

#vfs-tree {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: var(--rg-surface);
  border-bottom: 1px solid var(--rg-line);
}

#vfs-tree button {
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  color: var(--rg-muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#vfs-tree button:hover {
  color: var(--rg-text);
  border-color: var(--rg-muted);
}

#vfs-tree button.on {
  background: var(--rg-text);
  border-color: var(--rg-text);
  color: var(--rg-bg);
  font-weight: 650;
}

#vfs-tree button.is-dirty::after {
  content: " ●";
  color: #f59e0b;
}

.file-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 6px 12px;
  background: var(--rg-surface);
  border-bottom: 1px solid var(--rg-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.file-actions::-webkit-scrollbar {
  display: none;
}

.file-mode-group,
.file-crud-group,
.file-git-group,
.preview-viewport-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.file-git-group {
  margin-left: auto;
}

.file-mode-group {
  background: var(--rg-bg);
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--rg-line);
  gap: 2px;
}

.file-mode-group button {
  border: 0;
  background: transparent;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--rg-muted);
  cursor: pointer;
}

.file-mode-group button.is-active {
  background: var(--rg-surface);
  color: var(--rg-text);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.file-actions button,
.file-actions input {
  min-height: 28px;
  border-radius: 7px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  color: var(--rg-text);
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

#file-name {
  width: 122px;
  min-width: 112px;
  flex-shrink: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
}

.commit-slider-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--rg-muted);
  padding: 0 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

#commit-slider {
  width: 52px;
  accent-color: var(--rg-text);
}

.hunk-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  background: var(--rg-bg);
  border-bottom: 1px solid var(--rg-line);
}

.hunk-stage-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--rg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hunk-stage-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hunk-accept,
.hunk-reject {
  min-height: 28px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.hunk-accept {
  border: 1px solid rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
}

.hunk-reject {
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.code-stage-box {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 10px 14px 14px;
  border: 1px solid var(--rg-line);
  border-radius: 12px;
  background: var(--rg-surface);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.code-stage-box .code-editor {
  border-top: 0;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.55;
}

.diff-line.add {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-radius: 4px;
  padding: 1px 6px;
}

.diff-line.del {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  border-radius: 4px;
  padding: 1px 6px;
}

:root[data-theme='dark'] .diff-line.add {
  color: #4ade80;
}

:root[data-theme='dark'] .diff-line.del {
  color: #f87171;
}

.preview-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--rg-line);
  background: var(--rg-surface);
}

.preview-viewport-group button {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  color: var(--rg-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.preview-viewport-group button:hover {
  border-color: var(--rg-text);
  color: var(--rg-text);
}

.living-doc-shell,
.living-sheet-shell {
  padding: 18px 16px 28px;
  background: var(--rg-bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--rg-font-sans, Inter, ui-sans-serif, system-ui, -apple-system, sans-serif);
  white-space: normal;
  border-top: none;
}

.monitor-section-head h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--rg-text);
}

.monitor-section-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--rg-muted);
  line-height: 1.45;
}

.monitor-card {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.monitor-card-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--rg-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.living-doc-diagram {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  overflow-x: auto;
}

.doc-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 10px;
}

.doc-module-item {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.doc-module-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.doc-module-top strong {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--rg-text);
}

.doc-module-role {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-module-syms {
  font-size: 11.5px;
  color: var(--rg-muted);
}

.doc-summary-foot {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--rg-line);
  font-size: 12px;
  color: var(--rg-muted);
}

.doc-readme-pre {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.sheet-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sheet-kpi-card {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-kpi-label {
  font-size: 11px;
  color: var(--rg-muted);
  font-weight: 500;
}

.sheet-kpi-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--rg-text);
  font-variant-numeric: tabular-nums;
}

.living-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin: 0;
}

.living-sheet-table th,
.living-sheet-table td {
  border-bottom: 1px solid var(--rg-line);
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 7px 6px;
  text-align: left;
  white-space: nowrap;
}

.living-sheet-table th {
  background: var(--rg-bg);
  color: var(--rg-muted);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.living-sheet-table td.num-col {
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.sheet-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.sheet-status-pill.is-stable {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.sheet-status-pill.is-dirty {
  background: var(--rg-surface-2);
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
}

.living-sheet-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.living-bar-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.living-bar-name {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--rg-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.living-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  overflow: hidden;
}

.living-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--rg-text);
}

.living-bar-val {
  text-align: right;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--rg-muted);
  font-variant-numeric: tabular-nums;
}

#tab-logs {
  background: #0b111c;
}

#tab-logs .console-output {
  background: #0b111c;
  color: #34d399;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.55;
}

#tab-logs .tool-trace-card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0 4px;
  color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#tab-logs .tool-trace-header {
  border-bottom: 1px solid #1e293b;
}

#tab-logs .tool-trace-badge {
  color: #60a5fa;
}

#tab-logs .tool-trace-timestamp {
  color: #94a3b8;
}

#tab-logs .trace-icon {
  background: #1e293b;
}

#tab-logs .trace-command,
#tab-logs .trace-path {
  color: #e2e8f0;
}

#tab-logs .trace-edit-block {
  background: #0b111c;
  border: 1px solid #1e293b;
}

#tab-files .file-actions {
  gap: 4px;
  padding: 6px 10px;
  justify-content: space-between;
}
#tab-files .file-mode-group,
#tab-files .file-crud-group,
#tab-files .file-git-group {
  gap: 3px;
}
#tab-files .file-mode-group button {
  padding: 2px 7px;
  font-size: 11px;
  min-height: 24px;
}
#tab-files .file-actions button,
#tab-files .file-actions input {
  min-height: 26px;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 6px;
}
#tab-files #file-name {
  width: 82px;
  font-size: 11px;
}
#tab-files .commit-slider-label {
  font-size: 10.5px;
  gap: 3px;
  padding: 0 1px;
}
#tab-files #commit-slider {
  width: 36px;
}

#tab-files .file-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px 8px;
  padding: 8px 12px;
  overflow: visible;
}
#tab-files .file-mode-group {
  grid-column: 1;
  grid-row: 1;
}
#tab-files .file-crud-group {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
#tab-files #file-name {
  width: 118px;
}
#tab-files .file-git-group {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  margin-left: 0;
  padding-top: 6px;
  border-top: 1px dashed var(--rg-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
#tab-files .commit-slider-label {
  margin-right: auto;
  font-size: 11.5px;
  gap: 6px;
}
#tab-files #commit-slider {
  width: 72px;
}

body.studio-page #btn-studio-send {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  border: none;
  outline: none;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--rg-accent);
  opacity: 0.45;
  cursor: pointer;
}

body.studio-page #btn-studio-send.is-ready {
  background: transparent;
  color: var(--rg-accent);
  opacity: 1;
}

.studio-reply-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.studio-reply-lead {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--rg-text);
}

.studio-file-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.studio-file-pill {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  color: var(--rg-text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
}

.studio-verify-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--rg-muted);
}

.studio-reply-card .studio-action-chips {
  padding: 0;
  border: 0;
  background: transparent;
  margin-top: 2px;
  width: 100%;
}

.chip-btn.is-primary {
  background: #1a4b8c;
  color: #ffffff;
  border-color: #1a4b8c;
  font-weight: 650;
}

.studio-canvas-pane:has(#tab-logs.active),
.studio-canvas-pane:has(#tab-logs.active) .canvas-content {
  background: #05080c;
  border-bottom: none;
}

#tab-logs {
  inset: 0;
  margin: 0;
  border: none;
  outline: none;
  background: #0b111c;
}

@media (max-width: 1023px) {
  .studio-canvas-pane {
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  .studio-canvas-pane:has(#tab-logs.active) {
    background: #05080c;
  }
}

body.studio-page #chat-input:focus,
body.studio-page #chat-input:focus-visible,
body.studio-page #composer button:focus,
body.studio-page #composer button:focus-visible,
body.studio-page #terminal-input:focus,
body.studio-page #terminal-input:focus-visible {
  outline: none;
  box-shadow: none;
}


@media (max-width: 640px) {
  .living-doc-shell,
  .living-sheet-shell {
    padding: 14px 12px 24px;
    gap: 12px;
  }
  .monitor-section-head h2 {
    font-size: 15px;
    line-height: 1.3;
  }
  .monitor-section-sub {
    font-size: 12px;
    line-height: 1.4;
  }
  .sheet-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .sheet-kpi-card {
    padding: 10px 12px;
  }
  .sheet-kpi-label {
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sheet-kpi-val {
    font-size: 15px;
  }
  .monitor-card {
    padding: 10px 10px;
    border-radius: 12px;
  }
  .living-sheet-table {
    width: 100%;
    table-layout: auto;
    font-size: 11px;
  }
  .living-sheet-table th {
    padding: 6px 4px;
    font-size: 10px;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .living-sheet-table td {
    padding: 6px 4px;
    white-space: nowrap;
  }
  .living-sheet-table td:nth-child(1) {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .living-sheet-table td:nth-child(2) {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .living-sheet-table th:nth-child(3),
  .living-sheet-table td:nth-child(3),
  .living-sheet-table th:nth-child(4),
  .living-sheet-table td:nth-child(4),
  .living-sheet-table th:nth-child(5),
  .living-sheet-table td:nth-child(5) {
    text-align: right;
  }
  .living-sheet-table th:nth-child(6),
  .living-sheet-table td:nth-child(6) {
    text-align: right;
  }
  .sheet-status-pill {
    padding: 2px 5px;
    font-size: 10px;
  }
  .living-bar-row {
    grid-template-columns: 104px minmax(0, 1fr) 48px;
    gap: 8px;
  }
  .living-bar-name {
    font-size: 11.5px;
  }
  .living-bar-val {
    font-size: 11px;
  }
}

.studio-topbar .topbar-center, .studio-topbar .desktop-crumb { display: none; }

body.studio-page #studio-attach-sheet {
  background: var(--rg-bg);
  border-top: 1px solid var(--rg-line);
}
body.studio-page #studio-attach-sheet .attach-card {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 14px;
  min-height: 68px;
  padding: 9px 6px 8px;
}
body.studio-page #studio-attach-sheet .attach-orb {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
}
body.studio-page #studio-attach-sheet .attach-group-card[hidden] { display: none; }
body.studio-page #studio-attach-sheet .attach-group-card:not([hidden]) {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
}
body.studio-page #studio-attach-sheet .attach-group-card .attach-plain[hidden] { display: none; }
body.studio-page #studio-attach-sheet .attach-group-card .attach-plain:not([hidden]) {
  padding: 8px 12px;
  min-height: 44px;
  border-radius: 0;
  border-bottom: 1px solid var(--rg-line-soft, var(--rg-line));
}
body.studio-page #studio-attach-sheet .attach-group-card .attach-plain:last-child {
  border-bottom: none;
}
body.studio-page #studio-attach-sheet .attach-row-mark {
  flex: 0 0 32px;
  width: 32px;
  max-width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 9px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  display: grid;
  place-items: center;
}

.canvas-head {
  background: var(--rg-bg);
  border-bottom: 1px solid var(--rg-line);
  padding: 8px 12px;
  gap: 8px;
}

.canvas-tabs {
  background: transparent;
  border: 0;
  padding: 0;
  gap: 6px;
}

.canvas-tabs .tab-btn {
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--rg-muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.canvas-tabs .tab-btn.active {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
  font-weight: 650;
  box-shadow: var(--rg-shadow);
}

#studio-sheet-close,
.studio-modal-header .sheet-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 9px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
  display: inline-grid;
  place-items: center;
}

.sandbox-pill {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--rg-text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.studio-empty-canvas .empty-canvas-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  box-shadow: var(--rg-shadow);
  color: var(--rg-text);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.studio-empty-canvas .empty-canvas-icon svg {
  width: 24px;
  height: 24px;
}

.monitor-summary-bar {
  margin: 0;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.monitor-summary-bar .hub-summary-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--rg-muted);
}

.monitor-summary-bar .hub-auto-chip {
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  font-size: 11px;
  font-weight: 600;
  color: var(--rg-text);
  display: inline-flex;
  align-items: center;
}

.monitor-card {
  border-radius: 18px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  box-shadow: var(--rg-shadow);
}

.sheet-kpi-card {
  border-radius: 14px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  box-shadow: var(--rg-shadow);
}

.code-stage-box {
  border-radius: 16px;
  border: 1px solid var(--rg-line);
  box-shadow: var(--rg-shadow);
}

#tab-logs {
  background: #141413;
}

#tab-logs .studio-hud {
  background: #1C1C1A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  color: #E5E4DF;
}

#tab-logs .console-output {
  background: #141413;
  color: #E5E4DF;
}

#tab-logs .tool-trace-card {
  background: #1C1C1A;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
}

#tab-logs .terminal-form {
  background: #1C1C1A;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

#tab-logs #btn-terminal-run {
  border-radius: 999px;
  background: #F3F2EE;
  color: #141413;
  border: 1px solid #F3F2EE;
  padding: 4px 12px;
}

.studio-modal-box {
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  border-radius: 22px;
}

.studio-modal-box.studio-modal-wide {
  width: min(560px, 94vw);
  max-height: 86vh;
}

.studio-modal-header {
  background: var(--rg-surface);
  border-bottom: 1px solid var(--rg-line);
}

.studio-modal-summary-bar {
  margin: 10px 16px 0;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-conn-hub-list {
  padding: 10px 16px 14px;
}

.studio-conn-group,
.studio-drive-group {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 18px;
  overflow: hidden;
}

.studio-conn-row,
.studio-drive-group .gdrive-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rg-line-soft, var(--rg-line));
  border-radius: 0;
}

.studio-conn-row:last-child,
.studio-drive-group .gdrive-row:last-child {
  border-bottom: none;
}

.studio-conn-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.studio-conn-toggle-btn,
.studio-conn-act-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--rg-line);
  background: var(--rg-bg);
  color: var(--rg-text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.studio-conn-toggle-btn.is-connected {
  background: var(--rg-text);
  color: var(--rg-bg);
  border-color: var(--rg-text);
}

.studio-vfs-event-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
}

.vfs-event-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--rg-text);
}

.vfs-event-sub {
  font-size: 12px;
  color: var(--rg-muted);
  line-height: 1.4;
}

.vfs-event-btn {
  align-self: flex-start;
  margin-top: 2px;
  cursor: pointer;
}

body.studio-page .studio-modal-box .attach-row-mark {
  flex: 0 0 34px;
  width: 34px;
  max-width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 9px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
  display: grid;
  place-items: center;
}

body.studio-page .studio-modal-box .attach-plain-label {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
  font-weight: 620;
  color: var(--rg-text);
}

body.studio-page .studio-modal-box .attach-row-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--rg-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-conn-title-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.studio-conn-title-line strong {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--rg-text);
}

.studio-conn-state-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  color: var(--rg-muted);
}

.studio-conn-state-tag.is-on {
  background: var(--rg-text);
  border-color: var(--rg-text);
  color: var(--rg-bg);
}

.studio-modal-header .status-pill {
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
}

.studio-modal-footer {
  padding: 12px 14px;
  gap: 8px;
  flex-wrap: wrap;
}

.studio-modal-footer .btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
}

@media (max-width: 1023px) {
  .sandbox-pill,
  .hud-chips {
    display: none;
  }
}

.living-doc-diagram svg {
  display: block;
  width: 100%;
  min-height: 92px;
  height: auto;
}

.file-actions .file-mode-group,
.file-actions .file-crud-group,
.file-actions .file-git-group {
  flex: 0 0 auto;
  width: auto;
  position: static;
}

.studio-conn-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.studio-conn-title-line strong {
  white-space: nowrap;
}

.living-doc-shell > *,
.living-sheet-shell > * {
  flex-shrink: 0;
}

.living-doc-shell .monitor-card,
.living-sheet-shell .monitor-card {
  overflow: visible;
}

.studio-conn-name {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--rg-text);
  line-height: 1.25;
}

.studio-conn-act-btn.is-connected {
  background: var(--rg-text);
  border-color: var(--rg-text);
  color: var(--rg-bg);
}

@media (max-width: 640px) {
  #tab-files #vfs-tree {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 4px;
    padding: 7px 10px;
  }
  #tab-files #vfs-tree::-webkit-scrollbar {
    display: none;
  }
  #tab-files #vfs-tree button {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 10.6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }
  #tab-files .file-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 6px 6px;
    padding: 7px 10px;
  }
  #tab-files .file-mode-group {
    grid-column: 1;
    grid-row: 1;
    padding: 2px;
  }
  #tab-files .file-mode-group button {
    min-height: 24px;
    padding: 2px 7px;
    font-size: 10.8px;
  }
  #tab-files .file-crud-group {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }
  #tab-files #file-name {
    flex: 1 1 56px;
    width: auto;
    min-width: 52px;
    min-height: 26px;
    padding: 2px 6px;
    font-size: 10.8px;
  }
  #tab-files .file-crud-group button {
    min-height: 26px;
    padding: 2px 6px;
    font-size: 10.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  #tab-files .file-git-group {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    padding-top: 6px;
    border-top: 1px dashed var(--rg-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-width: 0;
  }
  #tab-files .commit-slider-label {
    font-size: 10.5px;
    gap: 4px;
    margin-right: auto;
  }
  #tab-files #commit-slider {
    width: 44px;
  }
  #tab-files .file-git-group button {
    min-height: 26px;
    padding: 2px 6.5px;
    font-size: 10.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  #tab-files .hunk-stage {
    padding: 6px 10px;
    gap: 6px;
  }
  #tab-files .hunk-stage-label {
    font-size: 11.2px;
  }
  #tab-files .code-stage-box {
    margin: 8px 10px 12px;
  }
}

#btn-close-sidebar {
  display: none;
}

.canvas-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  gap: 6px;
}

.canvas-head-right {
  margin-left: 0;
  flex: 0 0 auto;
}

#studio-sheet-close {
  position: static;
  right: auto;
  top: auto;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
}

.canvas-tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.canvas-tabs::-webkit-scrollbar {
  display: none;
}

@media (max-width: 640px) {
  .canvas-tabs {
    gap: 2px;
  }
  .canvas-tabs .tab-btn {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 11.8px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

.studio-modal-summary-bar,
.studio-modal-box .hub-summary-bar {
  width: auto;
  max-width: calc(100% - 28px);
  margin: 10px 14px 0;
  padding: 9px 12px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.studio-modal-summary-bar .hub-summary-left {
  flex: 1 1 auto;
  min-width: 0;
}

.studio-modal-summary-bar .hub-summary-count {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--rg-muted);
}

.studio-modal-summary-bar .hub-auto-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  font-size: 11px;
  font-weight: 600;
  color: var(--rg-text);
  display: inline-flex;
  align-items: center;
}

.studio-real-app-icon svg,
#studio-connector-panel .attach-row-mark svg,
#modal-studio-connectors .attach-row-mark svg {
  width: 20px;
  height: 20px;
}

#studio-attach-sheet button[hidden],
#studio-connector-panel button[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .canvas-head {
    padding: 6px 6px;
    gap: 3px;
  }
  .canvas-head .canvas-tabs,
  .canvas-tabs {
    padding: 0;
    gap: 1px;
  }
  .canvas-head .canvas-tabs .tab-btn,
  .canvas-tabs .tab-btn {
    min-height: 26px;
    padding: 3px 4px;
    font-size: 9.8px;
    letter-spacing: -0.025em;
    white-space: nowrap;
    flex-shrink: 0;
    outline: none;
  }
  #studio-sheet-close {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    flex: 0 0 28px;
  }
}

.studio-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
}

.studio-modal-header .modal-title-group {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.studio-modal-header .modal-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--rg-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-modal-header .status-pill {
  flex: 0 0 auto;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-modal-header .sheet-close {
  position: static;
  flex: 0 0 32px;
  margin-left: auto;
}

.studio-conn-row {
  min-height: 52px;
  padding: 9px 14px;
  align-items: center;
}

.studio-conn-act-btn,
.studio-conn-toggle-btn {
  white-space: nowrap;
  flex: 0 0 auto;
  height: 28px;
  padding: 0 11px;
  font-size: 11.5px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hud-chips,
body.studio-page .studio-app.is-split:not(.is-sidebar-collapsed) .sandbox-pill {
  display: none;
}

@media (max-width: 1440px) {
  .sandbox-pill {
    display: none;
  }
}

@media (min-width: 641px) {
  .canvas-tabs {
    gap: 6px;
  }
  .canvas-tabs .tab-btn {
    padding: 5px 10px;
    font-size: 12.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

.studio-modal-list .studio-conn-act-btn,
.studio-modal-list .studio-conn-toggle-btn {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  padding: 0 11px;
  height: 28px;
  border-radius: 999px;
  text-align: center;
  justify-content: center;
}

.studio-conn-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#studio-sidebar .studio-sidebar-footer {
  margin-top: auto;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--rg-line);
  background: var(--rg-bg);
  flex-shrink: 0;
}

#studio-sidebar #sidebar-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 2px 4px;
  background: transparent;
  border: 0;
}

#studio-sidebar #sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--rg-surface-2);
  color: var(--rg-text);
  border: 1px solid var(--rg-line);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

#studio-sidebar #sidebar-user-avatar.is-logged {
  background: var(--rg-text);
  color: var(--rg-bg);
  border-color: var(--rg-text);
}

#studio-sidebar #sidebar-user-avatar:hover,
#studio-sidebar #btn-settings:hover {
  transform: translateY(-1px);
  box-shadow: var(--rg-shadow);
}

#studio-sidebar #btn-settings {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--rg-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

#studio-sidebar #btn-settings:hover {
  background: var(--rg-surface);
  color: var(--rg-text);
  border-color: var(--rg-line);
}

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

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

.tab-panel.active.is-tab-entering {
  animation: rgMonitorTabIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.code-stage-box.is-file-switching {
  animation: rgFileSwitchIn 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.canvas-tabs .tab-btn,
#vfs-tree button,
.file-mode-group button,
.file-actions button,
.hunk-accept,
.hunk-reject,
.preview-viewport-group button,
#btn-inspect-dom,
#btn-terminal-run {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.16s cubic-bezier(0.22, 1, 0.36, 1),
              color 0.16s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.16s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.canvas-head .canvas-tabs .tab-btn:not(.active),
.canvas-tabs .tab-btn:not(.active) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  outline: none;
}

@media (hover: hover) and (pointer: fine) {
  .canvas-tabs .tab-btn:not(.active):hover {
    background: var(--rg-surface-2);
    color: var(--rg-text);
    border-color: var(--rg-line);
    transform: translateY(-1px);
  }
}

.canvas-tabs .tab-btn:active,
#vfs-tree button:active,
.file-mode-group button:active,
.file-actions button:active,
.hunk-accept:active,
.hunk-reject:active,
.preview-viewport-group button:active,
#btn-inspect-dom:active {
  transform: translateY(0) scale(0.97);
}

#vfs-tree button:not(.on):hover,
.file-actions .file-crud-group button:hover,
.file-actions .file-git-group button:hover,
.preview-viewport-group button:hover {
  background: var(--rg-surface-2);
  color: var(--rg-text);
  border-color: rgba(15, 20, 28, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15, 20, 28, 0.06);
}

.file-mode-group button:not(.is-active):hover {
  color: var(--rg-text);
  background: rgba(15, 20, 28, 0.04);
}

.hunk-accept:hover,
.hunk-reject:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 20, 28, 0.08);
}



body.studio-page #studio-inspiration,
body.studio-page .studio-app .inspiration-cards,
body.studio-page .studio-app:not(.is-active) .inspiration-cards {
  display: none;
}

@media (max-width: 1023px) {
  body.studio-page .studio-canvas-pane {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh;
    border-radius: 0;
    z-index: 130;
  }
  body.studio-page .studio-sidebar-col {
    z-index: 165;
  }
  body.studio-page #studio-drawer-backdrop {
    z-index: 160;
  }
  body.studio-page .canvas-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 8px;
    gap: 4px;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
  }
  body.studio-page .canvas-head .canvas-tabs {
    gap: 2px;
    padding: 0;
  }
  body.studio-page .canvas-head .canvas-tabs .tab-btn {
    min-height: 29px;
    padding: 4px 6.5px;
    font-size: 11px;
    letter-spacing: -0.015em;
  }
  body.studio-page .canvas-head .sandbox-pill,
  body.studio-page .canvas-head .hud-chips {
    display: none;
  }
  body.studio-page #studio-sheet-close {
    display: inline-grid;
    place-items: center;
    position: static;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 9px;
    background: var(--rg-surface);
    border: 1px solid var(--rg-line);
    color: var(--rg-text);
  }
}

#studio-sidebar #sidebar-user-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--rg-text);
  color: var(--rg-bg);
  border: 0;
  font-size: 13.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.studio-settings-screen:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: var(--rg-bg);
  color: var(--rg-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.studio-settings-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  height: 60px;
  min-height: 60px;
  padding: 0 16px;
  background: var(--rg-bg);
  border-bottom: 1px solid var(--rg-line);
  flex-shrink: 0;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.studio-settings-back {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  color: var(--rg-text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: var(--rg-shadow);
}

.studio-settings-title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--rg-text);
}

.studio-settings-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 32px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.studio-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  box-shadow: var(--rg-shadow);
}

.studio-summary-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rg-muted);
}

.studio-summary-chip {
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  font-size: 11.5px;
  font-weight: 650;
  color: var(--rg-text);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.studio-profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  margin-bottom: 12px;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 20px;
  box-shadow: var(--rg-shadow);
  cursor: pointer;
}

.studio-profile-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--rg-text);
  color: var(--rg-bg);
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.studio-profile-meta {
  flex: 1 1 0%;
  min-width: 0;
  text-align: left;
}

.studio-profile-name {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--rg-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-profile-mail {
  font-size: 12px;
  color: var(--rg-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-row-mark {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 9px;
  background: var(--rg-bg);
  border: 1px solid var(--rg-line);
  color: var(--rg-text);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.studio-segmented {
  display: flex;
  background: var(--rg-surface-2);
  padding: 3px;
  border-radius: 12px;
  gap: 2px;
  border: 1px solid var(--rg-line);
  width: 100%;
}

.studio-seg-btn {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rg-muted);
  background: transparent;
  cursor: pointer;
}

.studio-seg-btn.is-active {
  background: var(--rg-text);
  color: var(--rg-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.studio-set-group {
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--rg-shadow);
}

.studio-set-kicker {
  margin: 12px 0 6px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rg-muted);
}

.studio-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  min-height: 54px;
  border-bottom: 1px solid var(--rg-line-soft, var(--rg-line));
  background: transparent;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  color: var(--rg-text);
  cursor: pointer;
}

.studio-set-row:last-child {
  border-bottom: 0;
}

.studio-set-row-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.studio-set-row-title {
  display: block;
  font-size: 14.5px;
  font-weight: 560;
  color: var(--rg-text);
}

.studio-set-row-sub {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--rg-muted);
  margin-top: 2px;
}

.studio-set-row-right {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rg-muted);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}


.studio-hist-search {
  padding: 2px 10px 4px;
  flex-shrink: 0;
}
#studio-history-search.hist-search-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--rg-surface);
  border: 1px solid var(--rg-line);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--rg-text);
  outline: none;
}
#studio-history-search.hist-search-input:focus {
  border-color: var(--rg-muted);
}
#studio-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 10px 14px;
}
#studio-history .hist-group {
  font-size: 11px;
  font-weight: 700;
  color: var(--rg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 6px 2px;
}
#studio-history .history-row.hist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--rg-line);
  background: var(--rg-surface);
  color: var(--rg-muted);
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
#studio-history .history-row.hist-item:hover {
  background: var(--rg-ring);
  color: var(--rg-text);
}
#studio-history .history-row.hist-item.active {
  background: var(--rg-surface-2);
  color: var(--rg-text);
  font-weight: 600;
}
#studio-history .history-row.hist-item .hist-pin {
  flex-shrink: 0;
  color: var(--rg-text);
  display: inline-flex;
  align-items: center;
  opacity: 0.72;
}
#studio-history .history-row.hist-item .history-title {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--rg-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
#studio-history .history-row.hist-item .history-title:hover {
  background: transparent;
}
#studio-history .history-row.hist-item .history-del {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rg-muted);
  background: transparent;
  cursor: pointer;
}
#studio-history .history-row.hist-item .history-del:hover {
  background: var(--rg-ring);
  color: var(--rg-danger);
}
body.studio-page .msg.ai .msg-content {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--rg-text);
}
body.studio-page .msg.ai .msg-meta {
  font-size: 11px;
  color: var(--rg-muted);
  margin-top: 6px;
  opacity: 0.78;
}
body.studio-page .msg.ai .msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
body.studio-page .msg.ai .msg-act {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--rg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
body.studio-page .msg.ai .msg-act:hover {
  background: var(--rg-surface-2);
  color: var(--rg-text);
}
body.studio-page .msg.ai .msg-act svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.studio-page #messages .chat-stream-disclaimer {
  margin: 8px auto 0;
  padding: 6px 12px 2px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--rg-muted);
  opacity: 0.86;
}

}
