/* URDF / SRDF motion panel */
.urdf-artifact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.urdf-artifact-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--panel);
  padding: 6px 10px;
  font-size: 12px;
  text-decoration: none;
}

.urdf-artifact-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.urdf-joint-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 10px;
}

.urdf-joint-row span {
  text-transform: none;
}

.rigging-robot-artifacts {
  margin: 12px 0;
}

.rigging-robot-artifacts.urdf-joint-panel {
  padding: 12px;
  border-color: rgba(249, 115, 22, 0.22);
  background:
    radial-gradient(circle at 0% 0%, rgba(249, 115, 22, 0.1), transparent 38%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.88), rgba(13, 17, 23, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 34px rgba(1, 4, 9, 0.18);
}

.rigging-robot-artifacts .cad-param-head {
  align-items: center;
  gap: 10px;
}

.rigging-robot-artifacts .cad-param-head strong {
  color: #f0f6fc;
  letter-spacing: 0.01em;
}

.rigging-robot-artifacts .cad-param-head span {
  color: #9da7b3;
}

.rigging-robot-artifacts .cad-param-row {
  gap: 7px;
  margin-top: 10px;
}

.rigging-robot-artifacts .cad-param-row select {
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018)),
    rgba(1, 4, 9, 0.52);
  color: #e6edf3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.rigging-robot-artifacts .cad-param-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.rigging-robot-artifacts .btn {
  position: relative;
  min-height: 34px;
  border-radius: 12px;
  border-color: rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.022)),
    rgba(22, 27, 34, 0.94);
  color: #e6edf3;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 22px rgba(1, 4, 9, 0.18);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.rigging-robot-artifacts .btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.7);
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.35);
}

.rigging-robot-artifacts .btn:hover {
  transform: translateY(-1px);
  border-color: rgba(249, 115, 22, 0.58);
  background:
    radial-gradient(circle at 0% 0%, rgba(249, 115, 22, 0.16), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.026)),
    rgba(22, 27, 34, 0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 14px 28px rgba(1, 4, 9, 0.24),
    0 0 0 1px rgba(249, 115, 22, 0.08);
}

#btn-rigging-artifacts-refresh {
  min-height: 32px;
  padding-inline: 12px;
}

#btn-rigging-artifacts-refresh::before {
  content: "↻";
  width: auto;
  height: auto;
  background: transparent;
  color: #a5d6ff;
  box-shadow: none;
  font-size: 0.86rem;
}

#btn-rigging-generate-urdf::before {
  background: #7dd3fc;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.5);
}

#btn-rigging-generate-srdf::before {
  background: #c084fc;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.48);
}

#btn-rigging-generate-robot {
  grid-column: 1 / -1;
  color: #dbffe5;
  border-color: rgba(63, 185, 80, 0.52);
  background:
    radial-gradient(circle at 0% 0%, rgba(63, 185, 80, 0.2), transparent 46%),
    linear-gradient(135deg, rgba(35, 134, 54, 0.58), rgba(13, 17, 23, 0.96));
}

#btn-rigging-generate-robot::before {
  background: #3fb950;
  box-shadow: 0 0 14px rgba(63, 185, 80, 0.65);
}

#btn-rigging-author-jake {
  min-height: 40px;
  margin-top: 10px;
  justify-content: center;
  color: #fff7ed;
  border-color: rgba(249, 115, 22, 0.68);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 209, 102, 0.2), transparent 38%),
    linear-gradient(135deg, #9a3412, #f97316 52%, #fb923c);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 14px 32px rgba(249, 115, 22, 0.22);
}

#btn-rigging-author-jake::before {
  content: "AI";
  width: auto;
  height: auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.18);
  color: #fff7ed;
  box-shadow: none;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

#btn-rigging-author-jake:hover {
  border-color: rgba(253, 186, 116, 0.86);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 209, 102, 0.28), transparent 38%),
    linear-gradient(135deg, #b45309, #fb923c 56%, #fed7aa);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 18px 38px rgba(249, 115, 22, 0.28);
}

.urdf-planning-groups,
.urdf-planning-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.urdf-section-label {
  margin: 10px 0 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.urdf-group-state-row {
  width: 100%;
}

.urdf-link-tree {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 6px;
  margin-bottom: 8px;
}

.urdf-tree-root {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.urdf-tree-row,
.urdf-tree-joint {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  padding-left: calc(8px + (var(--depth, 0) * 14px));
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 12px;
}

.urdf-tree-row:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.urdf-tree-glyph {
  width: 14px;
  color: var(--muted);
  flex: 0 0 auto;
}

.urdf-tree-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.urdf-tree-row em,
.urdf-tree-joint em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.urdf-tree-joint {
  color: var(--muted);
}

.urdf-moveit2-panel {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.urdf-moveit2-xyz {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.urdf-moveit2-grid {
  display: grid;
  gap: 8px;
}

#urdf-moveit2-status.ok {
  color: var(--accent2);
}

#urdf-moveit2-status.error {
  color: var(--danger);
}

.urdf-motion-modal {
  align-items: stretch;
  justify-content: center;
  padding: 28px;
}

.urdf-motion-modal.urdf-motion-dock {
  position: absolute;
  inset: 58px 14px 86px auto;
  width: min(500px, calc(100% - 28px));
  height: auto;
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  background: transparent;
  pointer-events: none;
  z-index: 42;
}

.urdf-motion-modal.urdf-motion-dock .auth-backdrop {
  display: none;
}

.urdf-motion-card {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.urdf-motion-dock .urdf-motion-card {
  width: 100%;
  max-height: 100%;
  pointer-events: auto;
  border-color: rgba(249, 115, 22, 0.32);
  background:
    radial-gradient(circle at 12% 0%, rgba(249, 115, 22, 0.12), transparent 32%),
    rgba(13, 17, 23, 0.94);
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(249, 115, 22, 0.1);
  backdrop-filter: blur(12px);
}

.urdf-motion-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.urdf-motion-header h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.urdf-motion-header p {
  margin: 0;
  max-width: 52ch;
}

.urdf-motion-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.urdf-motion-header-actions .auth-close {
  position: static;
}

.urdf-motion-body {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.2fr);
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.urdf-motion-dock .urdf-motion-body {
  grid-template-columns: 1fr;
}

.urdf-motion-col {
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 20px;
}

.urdf-motion-col--main {
  border-left: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 88%, #000 12%);
}

.urdf-motion-dock .urdf-motion-col {
  padding: 12px 14px;
}

.urdf-motion-dock .urdf-motion-col--main {
  border-left: none;
  border-top: 1px solid var(--border);
}

.urdf-motion-dock .urdf-link-tree {
  max-height: 145px;
}

.urdf-motion-dock .urdf-motion-sliders {
  max-height: 230px;
}

.urdf-motion-dock .urdf-motion-header {
  padding: 13px 15px 11px;
}

.urdf-motion-dock .urdf-motion-header h2 {
  font-size: 1rem;
}

.urdf-motion-section {
  margin-bottom: 18px;
}

.urdf-motion-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.urdf-motion-section-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
}

.urdf-motion-section-head span {
  color: var(--muted);
  font-size: 11px;
}

.urdf-motion-sliders {
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.urdf-motion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.urdf-motion-moveit {
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

@media (max-width: 860px) {
  .urdf-motion-modal.urdf-motion-dock {
    inset: 54px 10px 72px 10px;
    width: auto;
  }

  .urdf-motion-body {
    grid-template-columns: 1fr;
  }

  .urdf-motion-col--main {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .urdf-motion-modal {
    padding: 12px;
  }
}
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent2: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 8px;
  --font: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Fira Code", monospace;
  --left-panel-width: 260px;
  --right-panel-width: 320px;
  --left-log-height: 160px;
  --timeline-height: 140px;
}

body.theme-light {
  --bg: #dbeafe;
  --panel: #f7fbff;
  --border: #9fb7d7;
  --text: #102033;
  --muted: #40566f;
  --accent: #1d4ed8;
  --accent2: #0f766e;
  --warn: #b7791f;
  --danger: #d83a52;
}

body.theme-light * {
  scrollbar-color: #c7d2df transparent;
}

body.theme-light *::-webkit-scrollbar-thumb {
  background: #c7d2df;
}

body.theme-light *::-webkit-scrollbar-thumb:hover {
  background: #9aa8b8;
}

body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  background: linear-gradient(180deg, #f8fbff, #eaf3ff);
  color: var(--text);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.theme-light {
  background:
    radial-gradient(circle at 10% 0%, rgba(14, 165, 233, 0.3), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(124, 58, 237, 0.23), transparent 30%),
    linear-gradient(135deg, #dbeafe 0%, #ccfbf1 47%, #fed7aa 100%);
}

body.theme-light .toolbar,
body.theme-light .sidebar,
body.theme-light .timeline-panel,
body.theme-light .prompt-panel,
body.theme-light .right-tab-panel,
body.theme-light .workspace-browser-section,
body.theme-light .design-browser-section,
body.theme-light .object-history-panel,
body.theme-light .team-panel,
body.theme-light .edit-panel {
  background:
    linear-gradient(180deg, rgba(236, 246, 255, 0.96), rgba(219, 234, 254, 0.9)),
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.16), transparent 42%);
  color: var(--text);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

body.theme-light .toolbar {
  background:
    linear-gradient(90deg, rgba(238, 247, 255, 0.98), rgba(204, 251, 241, 0.94)),
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(20, 184, 166, 0.14));
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.16);
}

body.theme-light .sidebar.left {
  background:
    linear-gradient(180deg, rgba(224, 242, 254, 0.96), rgba(204, 251, 241, 0.84)),
    radial-gradient(circle at 30% 0%, rgba(20, 184, 166, 0.2), transparent 38%);
}

body.theme-light .sidebar.right {
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(237, 233, 254, 0.86)),
    radial-gradient(circle at 80% 0%, rgba(124, 58, 237, 0.2), transparent 40%);
}

body.theme-light .btn,
body.theme-light .user-menu-item,
body.theme-light .viewport-view-btn,
body.theme-light .nav-tab {
  background: linear-gradient(180deg, #f8fbff, #dbeafe);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85), 0 6px 14px rgba(37, 99, 235, 0.06);
}

body.theme-light .btn:hover,
body.theme-light .user-menu-item:hover,
body.theme-light .viewport-view-btn:hover,
body.theme-light .nav-tab:hover,
body.theme-light .nav-tab.active {
  background: linear-gradient(180deg, #dbeafe, #bfdbfe);
  border-color: rgba(29, 78, 216, 0.5);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}

body.theme-light .btn.primary,
body.theme-light .btn.accent,
body.theme-light .viewport-view-btn.active,
body.theme-light .pick-btn.active,
body.theme-light .direct-tool-btn.active {
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  border-color: rgba(37, 99, 235, 0.5);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

body.theme-light .user-menu,
body.theme-light .profile-costs-panel,
body.theme-light .profile-workspace-panel,
body.theme-light .viewport-lighting-tab,
body.theme-light .section-view-panel,
body.theme-light .file-export-menu {
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(207, 250, 254, 0.92)),
    radial-gradient(circle at 18% 0%, rgba(29, 78, 216, 0.18), transparent 38%);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 18px 45px rgba(24, 35, 52, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.theme-light .muted,
body.theme-light .small {
  color: var(--muted);
}

body.theme-light .cloud-connections-card,
body.theme-light .project-browser,
body.theme-light .design-browser-root,
body.theme-light .object-history-list,
body.theme-light .prompt-history-list,
body.theme-light .ref-list,
body.theme-light .feature-editor {
  background: rgba(239, 246, 255, 0.72);
  border-color: rgba(59, 130, 246, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

body.theme-light .proj-item.active,
body.theme-light .browser-row.active,
body.theme-light .prompt-history-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.14), rgba(20, 184, 166, 0.12));
  border-color: rgba(37, 99, 235, 0.38);
}

body.theme-light #viewport {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.45), transparent 28%),
    linear-gradient(135deg, #dbeafe, #c7d2fe 48%, #ccfbf1);
}

body.theme-light .prompt-panel-tabs,
body.theme-light .right-panel-tabs,
body.theme-light .ribbon-body,
body.theme-light .ribbon-tabs {
  background: linear-gradient(90deg, rgba(219, 234, 254, 0.9), rgba(204, 251, 241, 0.74));
  border-color: rgba(96, 165, 250, 0.28);
}

body.theme-light .prompt-tab,
body.theme-light .right-panel-tab,
body.theme-light .ribbon-tab {
  color: #1e3a5f;
}

body.theme-light .prompt-tab.active,
body.theme-light .right-panel-tab.active,
body.theme-light .ribbon-tab.active {
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #ffffff;
}

body.theme-light #prompt-input,
body.theme-light #wiring-prompt-input,
body.theme-light #rigging-prompt-input,
body.theme-light #sketch-prompt-input {
  background: linear-gradient(180deg, #ffffff, #edf6ff);
  border-color: rgba(37, 99, 235, 0.3);
  color: #0f172a;
}

body.theme-light .prompt-history-item,
body.theme-light .prompt-history-summary,
body.theme-light .profile-cost-card,
body.theme-light .current-project-usage,
body.theme-light .prompt-key-popup,
body.theme-light .prompt-inline-ref-chips,
body.theme-light .ref-chip {
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.86), rgba(224, 242, 254, 0.78));
  border-color: rgba(59, 130, 246, 0.24);
  color: #102033;
}

body.theme-light .viewport-spinner--v2 {
  background: linear-gradient(145deg, rgba(43, 32, 12, 0.96), rgba(92, 64, 12, 0.94));
  color: #fff7d6;
}

body.theme-light .viewport-generation-user,
body.theme-light .viewport-hint,
body.theme-light .gizmo-panel {
  background: rgba(20, 35, 58, 0.9);
  border-color: rgba(125, 211, 252, 0.42);
  color: #f8fbff;
}

body.theme-light .viewport-generation-user--rigging {
  background: rgba(69, 36, 15, 0.92);
  border-color: rgba(249, 115, 22, 0.55);
}

body.theme-light .viewport-generation-user .muted,
body.theme-light .viewport-hint .muted,
body.theme-light .gizmo-panel .muted {
  color: #cfe8ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Dark-theme scrollbars (sidebar, panels, lists) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.hidden { display: none !important; }

.catalog-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.texture-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.texture-panel {
  width: min(1080px, 96vw);
  max-height: min(820px, 92vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  padding: 16px;
}

.texture-panel-head,
.texture-panel-toolbar,
.texture-panel-actions,
.texture-profile-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.texture-panel-head { justify-content: space-between; }
.texture-panel-head > div { display: flex; flex-direction: column; gap: 3px; }
.texture-panel-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}
.texture-panel-toolbar { justify-content: space-between; flex-wrap: wrap; }
.texture-panel-tabs {
  display: flex;
  gap: 6px;
}
.texture-panel-tabs button {
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.8);
  color: #8b949e;
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
}
.texture-panel-tabs button.active {
  border-color: rgba(88, 166, 255, 0.55);
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.14);
}
.texture-upload-btn { cursor: pointer; }
.texture-panel-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.9fr);
  gap: 14px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.texture-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
  align-content: start;
}
.texture-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  place-items: start;
  padding: 28px 12px;
}
.texture-card {
  position: relative;
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.72);
  padding: 8px;
  color: inherit;
  cursor: pointer;
}
.texture-card.active,
.texture-card:hover {
  border-color: rgba(88, 166, 255, 0.55);
  background: rgba(56, 139, 253, 0.1);
}
.texture-card-previews {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 6px;
  min-height: 92px;
}
.texture-card-sphere,
.texture-card-source {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  background: #010409;
  border: 1px solid rgba(48, 54, 61, 0.8);
  min-height: 92px;
}
.texture-card-sphere img,
.texture-card-source img,
.texture-profile-sphere img,
.texture-profile-source img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.texture-card-meta {
  display: grid;
  gap: 2px;
  padding: 0 2px 2px;
}
.texture-card-meta strong {
  font-size: 0.86rem;
  line-height: 1.25;
}
.texture-card-star {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(1, 4, 9, 0.72);
  color: #d2a8ff;
  font-size: 0.95rem;
}
.texture-card.is-favorite .texture-card-star { color: #ffd166; }
.texture-panel-profile {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(13, 17, 23, 0.55);
  overflow: auto;
}
.texture-panel-profile.hidden { display: none; }
.texture-profile-sphere {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(48, 54, 61, 0.9);
  background:
    radial-gradient(circle at 30% 25%, rgba(88, 166, 255, 0.18), transparent 42%),
    #010409;
}
.texture-profile-source {
  display: grid;
  gap: 4px;
}
.texture-profile-source img {
  height: 96px;
  border-radius: 8px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  object-fit: cover;
}
.texture-profile-name {
  display: grid;
  gap: 4px;
}
.texture-profile-name input,
.texture-profile-target select {
  background: #0d1117;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.texture-profile-target {
  display: grid;
  gap: 4px;
}
.texture-profile-actions {
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .texture-panel-body {
    grid-template-columns: 1fr;
  }
  .texture-panel-profile {
    max-height: 46vh;
  }
}

.catalog-panel {
  width: min(960px, 94vw);
  max-height: min(760px, 90vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  padding: 16px;
}

.catalog-panel-head,
.catalog-panel-search,
.catalog-result-actions,
.catalog-price-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.catalog-panel-head { justify-content: space-between; }
.catalog-panel-head > div { display: flex; flex-direction: column; gap: 3px; }
.catalog-panel-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}
.catalog-panel-query {
  flex: 1;
  min-width: 0;
  background: #0d1117;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.catalog-source-filter {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(13, 17, 23, 0.55);
}
.catalog-source-filter-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.catalog-source-filter-head .muted {
  margin-right: auto;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.catalog-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.catalog-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #30363d;
  background: #111722;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.catalog-source-chip.active {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.12);
  color: var(--text);
}
.catalog-source-chip input {
  margin: 0;
}
.catalog-source-chip em {
  color: #9fb5d8;
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
}
.catalog-source-chip small {
  color: #7d8590;
  font-size: 10px;
  text-transform: uppercase;
}
.catalog-panel-results {
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
}
.catalog-result-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #0f141d;
}
.catalog-result-card--link {
  border-style: dashed;
  background: #101722;
}
.catalog-source-line {
  display: inline-flex;
  width: fit-content;
  color: #b9d3ff;
  border: 1px solid #33466d;
  background: rgba(88, 166, 255, 0.10);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}
.catalog-source-note {
  color: #d29922;
  font-size: 12px;
  margin: 0;
}
.catalog-result-thumb {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0f16;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.catalog-result-thumb img {
  max-width: 100%;
  max-height: 86px;
  object-fit: contain;
}
.catalog-result-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.catalog-price-links { flex-wrap: wrap; }
.catalog-price-links a {
  color: #c9d8ff;
  border: 1px solid #33466d;
  background: #172033;
  border-radius: 999px;
  padding: 4px 8px;
  text-decoration: none;
  font-size: 12px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body:not(.info-page) {
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
}

.studio-boot-screen {
  --boot-progress: 8;
  --boot-progress-pct: 8%;
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 18% 10%, rgba(88, 166, 255, 0.28), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(249, 115, 22, 0.24), transparent 32%),
    radial-gradient(circle at 56% 92%, rgba(2, 132, 199, 0.2), transparent 42%),
    linear-gradient(145deg, #010409 0%, #080b12 48%, #000 100%);
  color: #e6edf3;
  transition: opacity 0.36s ease, transform 0.36s ease, visibility 0.36s ease;
}

.studio-boot-screen::before,
.studio-boot-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.studio-boot-screen::before {
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(88, 166, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(88, 166, 255, 0.06) 2px, transparent 2px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.055) 2px, transparent 2px);
  background-size: 46px 46px, 46px 46px, 184px 184px, 184px 184px;
  mask-image: radial-gradient(circle at center, #000 0%, transparent 72%);
  animation: studio-grid-pan 9s linear infinite;
}

.studio-boot-screen.is-final-grid::before {
  opacity: 0.72;
  background-color: rgba(1, 4, 9, 0.28);
  background-image:
    linear-gradient(rgba(88, 166, 255, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.2) 1px, transparent 1px),
    linear-gradient(rgba(249, 115, 22, 0.1) 2px, transparent 2px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.085) 2px, transparent 2px);
  background-size: 34px 34px, 34px 34px, 170px 170px, 170px 170px;
  mask-image:
    linear-gradient(#000, #000),
    radial-gradient(circle at center, #000 0%, transparent 76%);
  animation: studio-grid-pan 5.2s linear infinite;
  transition: opacity 0.28s ease, background-size 0.28s ease;
}

.studio-boot-screen::after {
  background:
    linear-gradient(115deg, transparent 0%, rgba(88, 166, 255, 0.12) 44%, rgba(249, 115, 22, 0.1) 50%, transparent 62%);
  transform: translateX(calc(var(--boot-progress-pct) - 50%));
  filter: blur(16px);
}

.studio-boot-screen.is-final-grid::after {
  background:
    radial-gradient(circle at 50% 50%, rgba(88, 166, 255, 0.12), transparent 46%),
    linear-gradient(115deg, transparent 0%, rgba(88, 166, 255, 0.08) 44%, rgba(249, 115, 22, 0.08) 50%, transparent 62%);
}

.studio-boot-screen.is-done {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.015);
}

.studio-boot-card {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  min-height: 420px;
  overflow: hidden;
  padding: 30px 30px 92px;
  border: 1px solid rgba(249, 115, 22, 0.32);
  border-radius: 28px;
  background:
    radial-gradient(circle at 16% 0%, rgba(88, 166, 255, 0.2), transparent 38%),
    radial-gradient(circle at 84% 12%, rgba(249, 115, 22, 0.24), transparent 36%),
    linear-gradient(180deg, rgba(12, 17, 27, 0.94), rgba(4, 7, 13, 0.97)),
    rgba(13, 17, 23, 0.95);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.58),
    0 0 46px rgba(249, 115, 22, 0.14),
    0 0 48px rgba(88, 166, 255, 0.16);
}

.studio-boot-stage {
  position: relative;
  height: 228px;
  margin-bottom: 24px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 28% 18%, rgba(88, 166, 255, 0.22), transparent 32%),
    radial-gradient(circle at 74% 36%, rgba(249, 115, 22, 0.2), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.studio-boot-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(88, 166, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.1) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.45;
  animation: studio-stage-grid 5.8s linear infinite;
}

.studio-boot-stage::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 66px;
  height: 96px;
  opacity: 0.42;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0 52%, rgba(125, 211, 252, 0.2) 52% 54%, transparent 54%),
    linear-gradient(90deg, transparent 0 7%, rgba(125, 211, 252, 0.38) 7% 8%, transparent 8% 19%, rgba(253, 186, 116, 0.28) 19% 20%, transparent 20% 30%, rgba(125, 211, 252, 0.32) 30% 31%, transparent 31% 49%, rgba(253, 186, 116, 0.32) 49% 50%, transparent 50% 67%, rgba(125, 211, 252, 0.34) 67% 68%, transparent 68%),
    linear-gradient(180deg, transparent 0 23%, rgba(125, 211, 252, 0.18) 23% 24%, transparent 24% 47%, rgba(253, 186, 116, 0.14) 47% 48%, transparent 48%),
    linear-gradient(90deg, transparent 0 12%, rgba(8, 18, 31, 0.82) 12% 18%, transparent 18% 26%, rgba(8, 18, 31, 0.72) 26% 34%, transparent 34% 43%, rgba(8, 18, 31, 0.78) 43% 48%, transparent 48% 57%, rgba(8, 18, 31, 0.7) 57% 65%, transparent 65% 75%, rgba(8, 18, 31, 0.78) 75% 82%, transparent 82%);
  clip-path: polygon(0 100%, 0 64%, 12% 64%, 12% 28%, 18% 28%, 18% 100%, 26% 100%, 26% 12%, 34% 12%, 34% 100%, 43% 100%, 43% 42%, 48% 42%, 48% 100%, 57% 100%, 57% 22%, 65% 22%, 65% 100%, 75% 100%, 75% 4%, 82% 4%, 82% 100%, 100% 100%);
  filter: drop-shadow(0 0 12px rgba(88, 166, 255, 0.18));
}

.studio-boot-grid {
  position: absolute;
  inset: auto -48px -8px;
  height: 112px;
  background-image:
    linear-gradient(rgba(88, 166, 255, 0.32) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.28) 1px, transparent 1px);
  background-size: 32px 18px;
  transform: perspective(180px) rotateX(60deg);
  transform-origin: center bottom;
  opacity: 0.85;
  animation: studio-floor-grid 1.9s linear infinite;
}

.studio-boot-printer {
  position: absolute;
  left: 30px;
  bottom: 34px;
  width: 190px;
  height: 152px;
  border: 2px solid rgba(125, 211, 252, 0.48);
  border-bottom: 0;
  border-radius: 12px 12px 4px 4px;
  background:
    linear-gradient(90deg, rgba(125, 211, 252, 0.08), transparent 18% 82%, rgba(253, 186, 116, 0.08)),
    linear-gradient(180deg, rgba(8, 15, 27, 0.68), rgba(1, 4, 9, 0.05));
  box-shadow:
    inset 0 0 28px rgba(88, 166, 255, 0.12),
    0 0 30px rgba(88, 166, 255, 0.18);
}

.studio-boot-printer::before,
.studio-boot-printer::after {
  content: "";
  position: absolute;
  display: block;
}

.studio-boot-printer::before {
  left: 16px;
  right: 16px;
  top: 34px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.28), #cbd5e1, rgba(249, 115, 22, 0.72));
  box-shadow:
    0 0 14px rgba(125, 211, 252, 0.32),
    inset 0 -2px 0 rgba(15, 23, 42, 0.58);
}

.studio-boot-printer::after {
  right: 11px;
  top: 8px;
  width: 34px;
  height: 34px;
  border: 5px solid rgba(249, 115, 22, 0.86);
  border-left-color: rgba(125, 211, 252, 0.72);
  border-radius: 50%;
  background: #05070d;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.32);
  animation: studio-spool-spin 2.6s linear infinite;
}

.studio-boot-printer-head {
  position: absolute;
  left: 24px;
  top: 20px;
  width: 46px;
  height: 28px;
  border: 1px solid rgba(226, 232, 240, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 34%),
    linear-gradient(135deg, #1e293b, #64748b 46%, #fb923c);
  box-shadow:
    inset 0 -6px 10px rgba(15, 23, 42, 0.55),
    0 0 20px rgba(88, 166, 255, 0.52);
  animation: studio-printer-head 5.8s ease-in-out infinite;
}

.studio-boot-printer-head::after {
  content: "";
  position: absolute;
  left: 17px;
  bottom: -18px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 18px solid #e2e8f0;
  filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.85));
}

.studio-boot-print-beam {
  position: absolute;
  left: 48px;
  top: 53px;
  width: 8px;
  height: 72px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(249, 115, 22, 0), rgba(253, 186, 116, 0.94), rgba(88, 166, 255, 0));
  filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.86));
  opacity: 0.82;
  animation: studio-printer-beam 5.8s ease-in-out infinite;
}

.studio-boot-build-plate {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 4px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(88, 166, 255, 0.28), rgba(249, 115, 22, 0.74), rgba(88, 166, 255, 0.28));
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.36);
}

.studio-boot-part {
  position: absolute;
  display: block;
  border: 1px solid rgba(253, 186, 116, 0.74);
  background:
    repeating-linear-gradient(0deg, rgba(255, 237, 213, 0.12) 0 2px, transparent 2px 7px),
    linear-gradient(135deg, rgba(249, 115, 22, 0.92), rgba(180, 83, 9, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 237, 213, 0.24),
    0 0 18px rgba(249, 115, 22, 0.28);
  transform-origin: center bottom;
}

.studio-boot-part--base {
  left: 52px;
  bottom: 14px;
  width: 70px;
  height: 16px;
  border-radius: 4px 4px 2px 2px;
  animation: studio-part-build 5.8s ease-in-out infinite;
}

.studio-boot-part--arm {
  left: 68px;
  bottom: 31px;
  width: 38px;
  height: 48px;
  border-radius: 5px 5px 2px 2px;
  animation: studio-part-build 5.8s ease-in-out 0.16s infinite;
}

.studio-boot-part--cap {
  left: 57px;
  bottom: 72px;
  width: 60px;
  height: 18px;
  border-radius: 5px 5px 2px 2px;
  animation: studio-part-build 5.8s ease-in-out 0.32s infinite;
}

.studio-boot-robot {
  position: absolute;
  right: 10px;
  bottom: 28px;
  width: 250px;
  height: 170px;
  transform-origin: 168px 136px;
  animation: studio-robot-pick-place 5.8s ease-in-out infinite;
}

.studio-boot-robot-body,
.studio-boot-robot-head,
.studio-boot-robot-arm,
.studio-boot-robot-claw,
.studio-boot-robot-eye {
  position: absolute;
  display: block;
}

.studio-boot-robot-body {
  left: 122px;
  bottom: 0;
  width: 92px;
  height: 30px;
  border: 1px solid rgba(226, 232, 240, 0.48);
  border-radius: 8px 8px 14px 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 38%),
    linear-gradient(180deg, #f97316, #7c2d12);
  box-shadow:
    inset 0 -8px 12px rgba(67, 20, 7, 0.68),
    0 0 24px rgba(249, 115, 22, 0.2);
}

.studio-boot-robot-head {
  left: 132px;
  bottom: 22px;
  z-index: 3;
  width: 48px;
  height: 48px;
  border: 7px solid #f97316;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #0f172a 0 34%, #e2e8f0 35% 45%, #475569 46% 100%);
  box-shadow:
    inset 0 0 12px rgba(15, 23, 42, 0.72),
    0 0 0 3px rgba(255, 237, 213, 0.52),
    0 0 22px rgba(249, 115, 22, 0.28);
}

.studio-boot-robot-head::before {
  content: "";
  position: absolute;
  left: auto;
  right: 35px;
  bottom: 28px;
  width: 84px;
  height: 24px;
  border: 1px solid rgba(255, 237, 213, 0.48);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 38%),
    linear-gradient(90deg, #b45309, #fb923c 56%, #fdba74);
  transform: rotate(24deg);
  transform-origin: right center;
  box-shadow:
    inset 0 -7px 9px rgba(124, 45, 18, 0.58),
    0 0 18px rgba(249, 115, 22, 0.28);
}

.studio-boot-robot-eye {
  z-index: 4;
  width: 42px;
  height: 42px;
  border: 6px solid #f97316;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #0f172a 0 31%, #e2e8f0 32% 42%, #334155 43% 100%);
  box-shadow:
    inset 0 0 10px rgba(15, 23, 42, 0.7),
    0 0 0 2px rgba(255, 237, 213, 0.62),
    0 0 20px rgba(249, 115, 22, 0.3);
  animation: none;
}

.studio-boot-robot-eye--left {
  left: 54px;
  bottom: 92px;
}

.studio-boot-robot-eye--right {
  left: 8px;
  bottom: 105px;
  width: 30px;
  height: 30px;
  border-width: 5px;
}

.studio-boot-robot-arm {
  height: 22px;
  border: 1px solid rgba(255, 237, 213, 0.46);
  border-radius: 9px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(90deg, #b45309, #f97316 64%, #fdba74);
  transform-origin: right center;
  box-shadow:
    inset 0 -7px 8px rgba(124, 45, 18, 0.52),
    0 0 16px rgba(249, 115, 22, 0.22);
}

.studio-boot-robot-arm::before,
.studio-boot-robot-arm::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #0f172a 0 28%, #dbeafe 30% 44%, #f97316 46% 68%, #7c2d12 70%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 0 14px rgba(249, 115, 22, 0.34);
  transform: translateY(-50%);
  pointer-events: none;
}

.studio-boot-robot-arm::before {
  left: -13px;
}

.studio-boot-robot-arm::after {
  right: -13px;
}

.studio-boot-robot-arm--left {
  left: 42px;
  bottom: 108px;
  width: 88px;
  transform: rotate(5deg);
  animation: studio-robot-forearm 5.8s ease-in-out infinite;
  z-index: 2;
}

.studio-boot-robot-arm--right {
  left: -14px;
  bottom: 108px;
  width: 64px;
  height: 12px;
  transform: rotate(-12deg);
  border-color: rgba(226, 232, 240, 0.5);
  background: linear-gradient(90deg, #cbd5e1, #64748b);
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.18);
  animation: studio-robot-arm 5.8s ease-in-out infinite;
  z-index: 1;
}

.studio-boot-robot-claw {
  left: -74px;
  bottom: 92px;
  width: 62px;
  height: 38px;
  border: 0;
  border-radius: 0;
  transform-origin: right center;
  filter:
    drop-shadow(0 0 10px rgba(249, 115, 22, 0.46))
    drop-shadow(0 0 8px rgba(125, 211, 252, 0.18));
  animation: studio-robot-claw 5.8s ease-in-out infinite;
}

.studio-boot-robot-claw::before,
.studio-boot-robot-claw::after {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  width: 54px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cbd5e1, #64748b);
  transform-origin: left center;
}

.studio-boot-robot-claw::before {
  transform: rotate(-32deg);
}

.studio-boot-robot-claw::after {
  transform: rotate(32deg);
}

.studio-boot-drop-zone {
  position: absolute;
  right: 36px;
  bottom: 24px;
  width: 96px;
  height: 54px;
  border: 1px solid rgba(125, 211, 252, 0.36);
  border-radius: 6px 6px 3px 3px;
  background:
    repeating-linear-gradient(0deg, rgba(226, 232, 240, 0.18) 0 2px, rgba(249, 115, 22, 0.14) 2px 6px),
    linear-gradient(145deg, rgba(148, 163, 184, 0.32), rgba(249, 115, 22, 0.18));
  clip-path: polygon(0 100%, 0 60%, 12% 60%, 12% 42%, 30% 42%, 30% 24%, 50% 24%, 50% 12%, 71% 12%, 71% 32%, 88% 32%, 88% 100%);
  box-shadow:
    0 0 18px rgba(88, 166, 255, 0.2),
    inset 0 0 12px rgba(249, 115, 22, 0.08);
}

.studio-boot-transfer-part {
  position: absolute;
  left: 88px;
  bottom: 83px;
  z-index: 6;
  width: 38px;
  height: 24px;
  border: 1px solid rgba(226, 232, 240, 0.72);
  border-radius: 5px 5px 3px 3px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 237, 213, 0.16) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, rgba(249, 115, 22, 0.95), rgba(148, 163, 184, 0.84));
  box-shadow:
    0 0 18px rgba(249, 115, 22, 0.44),
    0 0 12px rgba(88, 166, 255, 0.22);
  opacity: 0;
  transform-origin: center;
  animation: studio-transfer-part 5.8s ease-in-out infinite;
}

.studio-boot-energy {
  position: absolute;
  left: 48px;
  right: 54px;
  bottom: 22px;
  height: 7px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.18);
}

.studio-boot-energy-fill {
  display: block;
  width: var(--boot-progress-pct);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0284c7, #58a6ff 48%, #fb923c 82%, #fdba74);
  box-shadow:
    0 0 22px rgba(88, 166, 255, 0.82),
    0 0 15px rgba(249, 115, 22, 0.62);
  transition: width 0.28s ease-out;
}

.studio-boot-spark {
  position: absolute;
  top: 50%;
  left: var(--boot-progress-pct);
  width: 32px;
  height: 2px;
  background: #ffedd5;
  filter:
    drop-shadow(0 0 8px #58a6ff)
    drop-shadow(0 0 8px #fb923c);
  transform-origin: left center;
  animation: studio-spark 0.75s steps(2, end) infinite;
}

.studio-boot-spark--a { transform: rotate(-24deg); }
.studio-boot-spark--b { animation-delay: 0.16s; transform: rotate(19deg) scaleX(0.72); }
.studio-boot-spark--c { animation-delay: 0.32s; transform: rotate(4deg) scaleX(0.52); }

.studio-boot-title {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.6rem);
  font-weight: 850;
  letter-spacing: -0.05em;
  color: #c5d0dc;
}

.studio-boot-sub {
  min-height: 1.4em;
  margin: 8px 0 14px;
  color: #8b949e;
  font-size: 0.95rem;
}

.studio-boot-tip {
  display: grid;
  gap: 5px;
  min-height: 78px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.12), rgba(249, 115, 22, 0.08)),
    rgba(1, 4, 9, 0.36);
  box-shadow: inset 0 0 18px rgba(88, 166, 255, 0.06);
}

.studio-boot-tip-kicker {
  width: max-content;
  padding: 3px 8px;
  border: 1px solid rgba(249, 115, 22, 0.32);
  border-radius: 999px;
  color: #fdba74;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.studio-boot-tip p {
  margin: 0;
  color: #dbeafe;
  font-size: 0.84rem;
  line-height: 1.4;
}

.studio-boot-tip strong {
  color: #fdba74;
}

.studio-boot-tip p.is-changing {
  animation: studio-tip-swap 0.42s ease both;
}

.studio-boot-learn-more {
  --learn-radius: 999px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  min-height: 48px;
  margin: 0 0 16px;
  padding: 8px 14px 8px 8px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(249, 115, 22, 0.48);
  border-radius: var(--learn-radius);
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(14, 165, 233, 0.16) 48%, rgba(88, 166, 255, 0.12)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
    rgba(8, 12, 20, 0.88);
  color: #f0f6fc;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(88, 166, 255, 0.08),
    0 10px 28px rgba(0, 0, 0, 0.28),
    0 0 22px rgba(249, 115, 22, 0.16);
  transition:
    border-radius 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s ease,
    padding 0.45s ease,
    gap 0.45s ease,
    background 0.35s ease;
}

.studio-boot-walkthroughs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 16px;
}

.studio-boot-walkthroughs .studio-boot-learn-more {
  width: 100%;
  min-height: 62px;
  margin: 0;
  padding-right: 12px;
}

.studio-boot-walkthroughs .studio-boot-learn-label {
  white-space: normal;
}

.studio-boot-learn-more--random {
  border-color: rgba(125, 211, 252, 0.42);
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(249, 115, 22, 0.16) 54%, rgba(88, 166, 255, 0.14)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
    rgba(8, 12, 20, 0.88);
}

.studio-boot-learn-more--random .studio-boot-learn-gear {
  color: #7dd3fc;
  font-weight: 950;
  font-size: 1rem;
}

.studio-boot-learn-more::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 50%, rgba(249, 115, 22, 0.28), transparent 42%),
    radial-gradient(circle at 86% 40%, rgba(56, 189, 248, 0.22), transparent 40%);
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.studio-boot-learn-more::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -30%;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: skewX(-18deg) translateX(-120%);
  transition: none;
  pointer-events: none;
}

.studio-boot-learn-more:hover::after,
.studio-boot-learn-more:focus-visible::after {
  animation: studio-learn-sheen 0.85s ease;
}

.studio-boot-learn-more:hover,
.studio-boot-learn-more:focus-visible {
  border-color: rgba(125, 211, 252, 0.78);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(56, 189, 248, 0.18),
    0 14px 34px rgba(0, 0, 0, 0.34),
    0 0 28px rgba(249, 115, 22, 0.22),
    0 0 28px rgba(56, 189, 248, 0.16);
}

.studio-boot-learn-gearbox {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.2), transparent 45%),
    linear-gradient(145deg, rgba(249, 115, 22, 0.35), rgba(14, 165, 233, 0.28));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 14px rgba(249, 115, 22, 0.22);
  transition:
    width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease,
    background 0.35s ease;
}

.studio-boot-learn-teeth {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  background:
    conic-gradient(
      from 0deg,
      transparent 0 10deg,
      rgba(253, 186, 116, 0.95) 10deg 18deg,
      transparent 18deg 46deg,
      rgba(125, 211, 252, 0.95) 46deg 54deg,
      transparent 54deg 82deg,
      rgba(253, 186, 116, 0.95) 82deg 90deg,
      transparent 90deg 118deg,
      rgba(125, 211, 252, 0.95) 118deg 126deg,
      transparent 126deg 154deg,
      rgba(253, 186, 116, 0.95) 154deg 162deg,
      transparent 162deg 190deg,
      rgba(125, 211, 252, 0.95) 190deg 198deg,
      transparent 198deg 226deg,
      rgba(253, 186, 116, 0.95) 226deg 234deg,
      transparent 234deg 262deg,
      rgba(125, 211, 252, 0.95) 262deg 270deg,
      transparent 270deg 298deg,
      rgba(253, 186, 116, 0.95) 298deg 306deg,
      transparent 306deg 334deg,
      rgba(125, 211, 252, 0.95) 334deg 342deg,
      transparent 342deg 360deg
    );
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  transition: opacity 0.35s ease;
}

.studio-boot-learn-gear {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #ffe8cc;
  transition: color 0.3s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.studio-boot-learn-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.studio-boot-learn-kicker {
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fdba74;
}

.studio-boot-learn-label {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #f8fbff;
  white-space: nowrap;
}

.studio-boot-learn-chevron {
  margin-left: 2px;
  color: rgba(226, 232, 240, 0.7);
  font-size: 1.15rem;
  font-weight: 500;
  transition: opacity 0.3s ease, transform 0.35s ease;
}

.studio-boot-learn-more.is-queued {
  --learn-radius: 14px;
  padding: 10px 14px 10px 10px;
  gap: 14px;
  border-color: rgba(125, 211, 252, 0.72);
  background:
    linear-gradient(145deg, rgba(14, 165, 233, 0.28), rgba(249, 115, 22, 0.2) 55%, rgba(88, 166, 255, 0.14)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    rgba(6, 10, 18, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(56, 189, 248, 0.12),
    0 0 0 1px rgba(249, 115, 22, 0.16),
    0 12px 32px rgba(0, 0, 0, 0.38),
    0 0 28px rgba(56, 189, 248, 0.2),
    0 0 24px rgba(249, 115, 22, 0.16);
}

.studio-boot-learn-more.is-queued .studio-boot-learn-gearbox {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(160deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(125, 211, 252, 0.35),
    inset 0 0 12px rgba(249, 115, 22, 0.18),
    0 0 16px rgba(56, 189, 248, 0.22);
}

.studio-boot-learn-more.is-queued .studio-boot-learn-teeth {
  opacity: 1;
  animation: studio-learn-teeth-spin 4.8s linear infinite;
}

.studio-boot-learn-more.is-queued .studio-boot-learn-gear {
  color: #7dd3fc;
  animation: studio-learn-gear-spin 2.4s linear infinite;
}

.studio-boot-learn-more.is-queued .studio-boot-learn-kicker {
  color: #7dd3fc;
}

.studio-boot-learn-more.is-queued .studio-boot-learn-chevron {
  opacity: 0;
  transform: translateX(6px);
}

.studio-boot-learn-more.is-morphing .studio-boot-learn-gearbox {
  animation: studio-learn-gearbox-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes studio-learn-sheen {
  from { transform: skewX(-18deg) translateX(-120%); }
  to { transform: skewX(-18deg) translateX(320%); }
}

@keyframes studio-learn-gear-spin {
  to { transform: rotate(360deg); }
}

@keyframes studio-learn-teeth-spin {
  to { transform: rotate(-360deg); }
}

@keyframes studio-learn-gearbox-pop {
  0% { transform: scale(0.86) rotate(-12deg); }
  55% { transform: scale(1.08) rotate(8deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@media (max-width: 820px) {
  .studio-boot-learn-more {
    width: 100%;
    justify-content: flex-start;
  }

  .studio-boot-learn-label {
    white-space: normal;
  }
}

.studio-boot-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.14);
  border: 1px solid rgba(249, 115, 22, 0.24);
  overflow: hidden;
}

.studio-boot-progress-fill {
  display: block;
  width: var(--boot-progress-pct);
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #0284c7, #58a6ff 45%, #fb923c 78%, #fdba74),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.2) 0 8px, transparent 8px 16px);
  box-shadow:
    0 0 18px rgba(88, 166, 255, 0.55),
    0 0 16px rgba(249, 115, 22, 0.36);
  transition: width 0.28s ease-out;
}

.studio-boot-progress-copy {
  margin: 8px 0 0;
  color: #c9d1d9;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.studio-boot-progress-copy span {
  color: #fdba74;
  text-shadow: 0 0 12px rgba(249, 115, 22, 0.58);
}

.studio-boot-logo {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 5100;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #e6edf3;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: none;
}

.studio-boot-gear-loader,
.studio-boot-spinner {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #7dd3fc;
  background:
    radial-gradient(circle, rgba(1, 4, 9, 0.96) 0 30%, transparent 31%),
    repeating-conic-gradient(
      from 0deg,
      #7dd3fc 0deg 11deg,
      transparent 11deg 24deg,
      #fb923c 24deg 35deg,
      transparent 35deg 48deg
    ),
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.24), transparent 44%),
    rgba(13, 17, 23, 0.86);
  box-shadow:
    inset 0 0 0 2px rgba(1, 4, 9, 0.9),
    inset 0 0 0 7px rgba(13, 17, 23, 0.94),
    0 0 18px rgba(88, 166, 255, 0.42),
    0 0 16px rgba(249, 115, 22, 0.22);
  animation: studio-gear-spin 1.2s linear infinite;
}

.studio-boot-gear-loader::before,
.studio-boot-spinner::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #050914;
  box-shadow:
    inset 0 0 0 2px rgba(125, 211, 252, 0.72),
    0 0 10px rgba(125, 211, 252, 0.38);
}

.studio-boot-gear-loader::after,
.studio-boot-spinner::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-right-color: rgba(251, 146, 60, 0.72);
  border-bottom-color: rgba(251, 146, 60, 0.36);
  filter: drop-shadow(0 0 8px rgba(251, 146, 60, 0.3));
  animation: studio-gear-orbit 1.8s linear infinite reverse;
}

.studio-boot-logo-word {
  font-size: clamp(1.25rem, 2.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: transparent;
  background-image:
    linear-gradient(
      165deg,
      rgba(255, 255, 255, 0.92) 0%,
      rgba(255, 255, 255, 0) 38%,
      rgba(255, 255, 255, 0) 62%,
      rgba(255, 255, 255, 0.35) 100%
    ),
    linear-gradient(
      118deg,
      #4b5563 0%,
      #9ca3af 12%,
      #f8fafc 26%,
      #6b7280 40%,
      #e5e7eb 52%,
      #52525b 66%,
      #ffffff 80%,
      #a1a1aa 100%
    );
  background-size: 100% 100%, 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35))
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.75))
    drop-shadow(0 0 12px rgba(148, 163, 184, 0.35));
}

.studio-boot-logo-percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.6em;
  margin-left: 2px;
  padding: 0.42em 0.7em;
  border-radius: 999px;
  border: 1px solid rgba(160, 210, 255, 0.38);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16), transparent 55%),
    rgba(10, 16, 26, 0.78);
  color: #8ed0ff;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 8px 20px rgba(0, 0, 0, 0.4);
  text-shadow: 0 0 14px rgba(88, 166, 255, 0.5);
}

.studio-boot-logo > .studio-boot-brand-mark,
.studio-boot-logo > img:not(.studio-boot-logo-gear-img) {
  width: 102px;
  height: 102px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  filter:
    drop-shadow(0 0 12px rgba(88, 166, 255, 0.7))
    drop-shadow(0 0 9px rgba(249, 115, 22, 0.55));
  animation: studio-logo-charge 1.6s ease-in-out infinite;
}

.browser-boot-spinner {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px;
}

.studio-boot-spinner {
  margin-bottom: 2px;
}

.studio-boot-spinner--inline {
  width: 24px;
  height: 24px;
  box-shadow:
    inset 0 0 0 2px rgba(1, 4, 9, 0.9),
    inset 0 0 0 5px rgba(13, 17, 23, 0.94),
    0 0 12px rgba(88, 166, 255, 0.34);
}

.studio-boot-spinner--inline::before {
  width: 8px;
  height: 8px;
}

.studio-boot-spinner--inline::after {
  inset: -4px;
}

@keyframes studio-printer-head {
  0%, 8%, 100% { transform: translateX(0); }
  20% { transform: translateX(96px); }
  34% { transform: translateX(30px); }
  46% { transform: translateX(108px); }
  56%, 92% { transform: translateX(108px); }
}

@keyframes studio-tip-swap {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes studio-printer-beam {
  0%, 8%, 100% { transform: translateX(0) scaleY(0.62); opacity: 0.36; }
  20% { transform: translateX(96px) scaleY(1.08); opacity: 1; }
  34% { transform: translateX(30px) scaleY(0.94); opacity: 0.82; }
  46% { transform: translateX(108px) scaleY(1); opacity: 0.9; }
  56%, 92% { transform: translateX(108px) scaleY(0.2); opacity: 0; }
}

@keyframes studio-part-build {
  0%, 12% { opacity: 0.18; transform: scaleY(0.12) translateY(8px); }
  42%, 56% { opacity: 1; transform: scaleY(1) translateY(0); }
  63%, 100% { opacity: 0; transform: scaleY(0.9) translateY(-5px); }
}

@keyframes studio-robot-pick-place {
  0%, 38%, 100% { transform: translate(0, 0); }
  48% { transform: translate(-22px, -2px) rotate(-2deg); }
  58% { transform: translate(-34px, -4px) rotate(-3deg); }
  72% { transform: translate(28px, -7px) rotate(3deg); }
  84% { transform: translate(44px, 0) rotate(3deg); }
  92% { transform: translate(0, 0); }
}

@keyframes studio-robot-arm {
  0%, 38%, 100% { transform: rotate(-12deg); }
  48%, 58% { transform: rotate(-5deg); }
  72% { transform: rotate(1deg); }
  84% { transform: rotate(-8deg); }
  92% { transform: rotate(-12deg); }
}

@keyframes studio-robot-forearm {
  0%, 38%, 100% { transform: rotate(5deg); }
  48%, 58% { transform: rotate(13deg); }
  72% { transform: rotate(-4deg); }
  84% { transform: rotate(4deg); }
  92% { transform: rotate(5deg); }
}

@keyframes studio-robot-claw {
  0%, 38%, 100% { transform: translate(0, 0) rotate(-8deg) scaleY(1); }
  48% { transform: translate(3px, 5px) rotate(-2deg) scaleY(1.12); }
  58% { transform: translate(3px, 5px) rotate(-1deg) scaleY(0.82); }
  72% { transform: translate(8px, -2px) rotate(4deg) scaleY(0.82); }
  84% { transform: translate(11px, 4px) rotate(-3deg) scaleY(1.1); }
  92% { transform: translate(0, 0) rotate(-8deg) scaleY(1); }
}

@keyframes studio-transfer-part {
  0%, 49% {
    opacity: 0;
    transform: translate(0, 0) scale(0.78);
  }
  54% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  62% {
    opacity: 1;
    transform: translate(118px, -58px) rotate(-5deg) scale(1);
  }
  76% {
    opacity: 1;
    transform: translate(258px, -44px) rotate(6deg) scale(1);
  }
  86%, 94% {
    opacity: 1;
    transform: translate(302px, -10px) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(302px, -10px) scale(0.9);
  }
}

@keyframes studio-robot-eyes {
  0%, 90%, 100% { transform: scaleY(1); }
  92% { transform: scaleY(0.18); }
}

@keyframes studio-spark {
  0% { opacity: 0.2; clip-path: polygon(0 45%, 28% 45%, 38% 0, 52% 100%, 64% 45%, 100% 45%, 100% 65%, 58% 65%, 49% 100%, 36% 14%, 30% 65%, 0 65%); }
  50% { opacity: 1; }
  100% { opacity: 0.35; clip-path: polygon(0 40%, 22% 40%, 34% 100%, 47% 0, 59% 55%, 100% 55%, 100% 74%, 52% 74%, 42% 18%, 31% 100%, 24% 58%, 0 58%); }
}

@keyframes studio-logo-charge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes studio-gear-spin {
  to { transform: rotate(360deg); }
}

@keyframes studio-gear-orbit {
  to { transform: rotate(-360deg); }
}

@keyframes studio-grid-pan {
  to { background-position: 46px 46px, -46px 46px, 184px 184px, -184px 184px; }
}

@keyframes studio-stage-grid {
  to { background-position: 34px 34px, -34px 34px; }
}

@keyframes studio-floor-grid {
  to { background-position: 0 18px, 32px 18px; }
}

@keyframes studio-spool-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .studio-boot-card {
    min-height: 390px;
    padding: 22px 18px 88px;
    border-radius: 22px;
  }

  .studio-boot-walkthroughs {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .studio-boot-walkthroughs .studio-boot-learn-more {
    min-height: 54px;
  }

  .studio-boot-stage {
    height: 210px;
  }

  .studio-boot-printer {
    left: 18px;
    width: 148px;
  }

  .studio-boot-robot {
    right: 26px;
    transform: scale(0.9);
    transform-origin: right bottom;
  }
}

@media (prefers-reduced-motion: reduce) {
  .studio-boot-screen,
  .studio-boot-screen::after,
  .studio-boot-printer-head,
  .studio-boot-print-beam,
  .studio-boot-part,
  .studio-boot-robot,
  .studio-boot-robot-arm,
  .studio-boot-robot-arm--right,
  .studio-boot-robot-claw,
  .studio-boot-robot-eye,
  .studio-boot-spark,
  .studio-boot-logo img,
  .studio-boot-gear-loader,
  .studio-boot-gear-loader::after,
  .studio-boot-spinner,
  .studio-boot-spinner::after,
  .studio-boot-learn-more.is-queued .studio-boot-learn-teeth,
  .studio-boot-learn-more.is-queued .studio-boot-learn-gear,
  .studio-boot-learn-more.is-morphing .studio-boot-learn-gearbox,
  .studio-boot-learn-more:hover::after {
    animation: none !important;
    transition: none !important;
  }
}

#app {
  display: grid;
  grid-template-columns: var(--left-panel-width) 6px 1fr 6px var(--right-panel-width);
  grid-template-rows: 52px 34px auto 1fr;
  grid-template-areas:
    "header      header      header      header      header"
    "wsbar       wsbar       wsbar       wsbar       wsbar"
    "ribbon      ribbon      ribbon      ribbon      ribbon"
    "left        left-split  main-col    right-split right";
  overflow: hidden;
  height: 100%;
}

#app:not(.app-info) {
  overscroll-behavior: none;
}

#workspace-mode-bar {
  grid-area: wsbar;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  min-height: 34px;
}

.fusion-mode-switcher {
  position: relative;
  flex-shrink: 0;
}

.workspace-mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  min-width: 132px;
  padding: 0 14px;
  border: none;
  border-right: 1px solid #21262d;
  background: #1c2128;
  color: #e6edf3;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.workspace-mode-btn:hover {
  background: #21262d;
}

.workspace-mode-icon {
  font-size: 0.95rem;
  opacity: 0.85;
}

.workspace-mode-caret {
  margin-left: auto;
  font-size: 0.65rem;
  color: #8b949e;
}

.workspace-mode-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 1200;
  min-width: 220px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 4px;
}

.workspace-mode-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #e6edf3;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.workspace-mode-option:hover:not(:disabled) {
  background: #30363d;
}

.workspace-mode-option.active {
  background: #388bfd22;
  color: #58a6ff;
}

.workspace-mode-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.workspace-tabs {
  display: flex;
  align-items: stretch;
  flex: 1;
  overflow-x: auto;
  min-width: 0;
}

.workspace-feedback-actions {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border-left: 1px solid #21262d;
}

.workspace-feedback-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #21262d;
  background: transparent;
  color: #c9d1d9;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.workspace-feedback-btn:hover {
  background: #21262d;
  color: #79c0ff;
}

.workspace-feedback-btn--bug:hover {
  color: #ffa657;
}

.workspace-feedback-btn--chat {
  position: relative;
  padding-right: 14px;
}

.workspace-feedback-btn--chat:hover {
  color: #7ee787;
}

.pc-btn-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  border-radius: 999px;
  background: #1f6feb;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
}

.pc-btn-badge--mention {
  background: #f85149;
}

.pc-btn-badge.hidden {
  display: none;
}

/* ── Project chat popup ───────────────────────────────────────────── */
.project-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 4, 9, 0.55);
  backdrop-filter: blur(2px);
}

.project-chat-overlay.hidden {
  display: none;
}

.project-chat-panel {
  width: min(980px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(88, 166, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #0d1117 0%, #010409 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.pc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.9);
}

.pc-head-main {
  min-width: 0;
}

.pc-head-main strong {
  display: block;
  font-size: 1rem;
}

.pc-subtitle {
  font-size: 0.72rem;
}

.pc-head-actions {
  display: flex;
  gap: 6px;
}

.pc-icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 8px;
  background: #161b22;
  color: #c9d1d9;
  cursor: pointer;
}

.pc-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.pc-people-plus-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pc-body {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.pc-threads {
  border-right: 1px solid rgba(48, 54, 61, 0.9);
  overflow-y: auto;
  padding: 8px;
}

.pc-thread-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.pc-thread-item strong {
  font-size: 0.78rem;
}

.pc-thread-item span {
  font-size: 0.68rem;
  color: #8b949e;
}

.pc-thread-item:hover,
.pc-thread-item.active {
  background: rgba(31, 111, 235, 0.12);
  border-color: rgba(31, 111, 235, 0.35);
}

.pc-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.pc-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-empty {
  margin: 24px auto;
  text-align: center;
  max-width: 36ch;
}

.pc-message {
  padding: 10px 12px;
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: 12px;
  background: rgba(22, 27, 34, 0.72);
}

.pc-message--agent {
  border-color: rgba(63, 185, 80, 0.35);
  background: rgba(35, 134, 54, 0.08);
}

.pc-message--reply {
  margin-left: calc(18px * var(--pc-depth, 1));
  margin-top: 8px;
}

.pc-message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pc-message-meta {
  min-width: 0;
  flex: 1;
}

.pc-message-meta strong {
  display: block;
  font-size: 0.78rem;
}

.pc-message-meta time {
  font-size: 0.66rem;
  color: #8b949e;
}

.pc-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #30363d center/cover no-repeat;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.pc-avatar--initial {
  background: #1f6feb;
  color: #fff;
}

.pc-avatar--agent {
  background: #238636;
}

.pc-reply-btn {
  border: 0;
  background: transparent;
  color: #8b949e;
  font-size: 0.68rem;
  cursor: pointer;
}

.pc-reply-btn:hover {
  color: #79c0ff;
}

.pc-message-body {
  font-size: 0.84rem;
  line-height: 1.45;
  word-break: break-word;
}

.pc-message-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78em;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(110, 118, 129, 0.2);
}

.pc-message-link {
  color: #79c0ff;
  text-decoration: none;
  border-bottom: 1px solid rgba(121, 192, 255, 0.45);
}

.pc-message-link:hover {
  color: #a5d6ff;
  border-bottom-color: currentColor;
}

.pc-link-previews {
  display: grid;
  gap: 8px;
  margin-top: 9px;
}

.pc-link-preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.72);
  color: inherit;
  text-decoration: none;
}

.pc-link-preview:hover {
  border-color: rgba(88, 166, 255, 0.55);
  background: rgba(31, 111, 235, 0.12);
}

.pc-link-preview-thumb {
  width: 92px;
  min-height: 74px;
  background: rgba(48, 54, 61, 0.9) center/cover no-repeat;
}

.pc-link-preview-body {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 9px 10px;
}

.pc-link-preview-body small {
  color: #8b949e;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-link-preview-body strong {
  color: #e6edf3;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-link-preview-body span {
  color: #8b949e;
  font-size: 0.74rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pc-link-preview--loading {
  opacity: 0.68;
  pointer-events: none;
}

.pc-mention {
  display: inline-flex;
  align-items: center;
  max-width: min(220px, 100%);
  margin: 0 1px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(56, 139, 253, 0.45);
  background: rgba(31, 111, 235, 0.22);
  color: #79c0ff;
  font-weight: 650;
  line-height: 1.25;
  vertical-align: baseline;
  white-space: nowrap;
}

.pc-mention-label {
  font-size: 0.86em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-mention--agent {
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(46, 160, 67, 0.18);
  color: #7ee787;
}

.pc-mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: min(220px, 100%);
  margin: 0 1px;
  padding: 0 1px 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(56, 139, 253, 0.45);
  background: rgba(31, 111, 235, 0.22);
  color: #79c0ff;
  font-weight: 650;
  line-height: 1.25;
  vertical-align: baseline;
  user-select: none;
}

.pc-mention-chip--agent {
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(46, 160, 67, 0.18);
  color: #7ee787;
}

.pc-mention-chip-label {
  font-size: 0.86em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pc-mention-chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.72;
  cursor: pointer;
  font-size: 0.95em;
  line-height: 1;
  padding: 0 5px 0 2px;
}

.pc-mention-chip-remove:hover {
  opacity: 1;
}

.pc-inbox-head {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.78);
}

.pc-inbox-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pc-inbox-tabs button {
  border: 1px solid rgba(139, 148, 158, 0.24);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.8);
  color: #8b949e;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.pc-inbox-tabs button.active {
  border-color: rgba(88, 166, 255, 0.5);
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.14);
}

.pc-thread-item small {
  color: #8b949e;
  font-size: 0.66rem;
}

.pc-thread-badge--group {
  color: #d2a8ff;
  border-color: rgba(210, 168, 255, 0.3);
}

.pc-collab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.75);
  background: rgba(13, 17, 23, 0.72);
}

.pc-collab-bar.hidden {
  display: none;
}

.pc-workspace-invite {
  display: grid;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 12px 14px;
  border: 1px solid rgba(56, 139, 253, 0.4);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(56, 139, 253, 0.16), rgba(13, 17, 23, 0.92)),
    rgba(22, 27, 34, 0.95);
  box-shadow: 0 10px 28px rgba(1, 4, 9, 0.28);
}

.pc-workspace-invite.hidden {
  display: none;
}

.pc-workspace-invite-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #79c0ff;
}

.pc-workspace-invite strong {
  color: #e6edf3;
}

.pc-workspace-invite p {
  margin: 0;
  line-height: 1.45;
  color: #c9d1d9;
  font-size: 0.9rem;
}

.pc-workspace-invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-invite-modal .workspace-invite-card {
  width: min(420px, 100%);
}

.workspace-invite-eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #79c0ff;
}

.workspace-invite-copy {
  margin: 0 0 16px;
  line-height: 1.5;
  color: var(--muted, #8b949e);
}

.workspace-invite-actions {
  justify-content: flex-end;
}

.pc-collab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pc-collab-actions .active {
  border-color: rgba(63, 185, 80, 0.55);
  color: #7ee787;
}

.pc-collab-status {
  color: #8b949e;
  font-size: 0.72rem;
  text-align: right;
}

.pc-group-modal {
  position: absolute;
  inset: 56px 18px auto auto;
  z-index: 4;
  width: min(360px, calc(100% - 36px));
}

.pc-group-modal.hidden {
  display: none;
}

.pc-group-card {
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 14px;
  background: #0d1117;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  padding: 12px;
}

.pc-thread-settings-card {
  width: min(500px, calc(100vw - 72px));
}

.pc-group-head,
.pc-group-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pc-group-label {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  color: #c9d1d9;
  font-size: 0.78rem;
}

.pc-group-label input {
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 10px;
  background: #010409;
  color: #e6edf3;
  padding: 9px 10px;
}

.pc-visibility-choice {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.pc-visibility-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 12px;
  background: rgba(22, 27, 34, 0.72);
  cursor: pointer;
}

.pc-visibility-card:has(input:checked) {
  border-color: rgba(126, 231, 135, 0.5);
  background: rgba(46, 160, 67, 0.12);
}

.pc-visibility-card input {
  margin-top: 3px;
}

.pc-visibility-card span {
  display: grid;
  gap: 2px;
}

.pc-visibility-card small,
.pc-group-head p {
  color: #8b949e;
}

.pc-settings-section {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.pc-member-list {
  display: grid;
  gap: 6px;
  max-height: 170px;
  overflow: auto;
}

.pc-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 10px;
  background: rgba(1, 4, 9, 0.42);
}

.pc-member-row span {
  display: grid;
  min-width: 0;
  font-size: 0.78rem;
}

.pc-member-row small {
  color: #8b949e;
  font-size: 0.66rem;
}

.pc-thread-context-menu {
  position: fixed;
  z-index: 10050;
  display: grid;
  min-width: 238px;
  padding: 6px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.52);
}

.pc-thread-context-menu button {
  appearance: none;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9d1d9;
  text-align: left;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.pc-thread-context-menu button:hover:not(:disabled) {
  background: rgba(56, 139, 253, 0.16);
}

.pc-thread-context-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.render-share-target-card {
  width: min(520px, calc(100vw - 32px));
}

.render-share-target-section {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.render-share-target-list {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
}

.render-share-target {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px;
  text-align: left;
  color: var(--text);
  background: rgba(13, 17, 23, 0.74);
  border: 1px solid rgba(139, 148, 158, 0.24);
  border-radius: 10px;
  cursor: pointer;
}

.render-share-target:hover:not(:disabled) {
  border-color: rgba(88, 166, 255, 0.58);
  background: rgba(31, 111, 235, 0.12);
}

.render-share-target:disabled {
  cursor: wait;
  opacity: 0.75;
}

.render-share-target small {
  color: var(--muted);
}

.pc-group-people {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  margin-bottom: 10px;
}

.pc-group-person {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: center;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 10px;
  padding: 8px;
  color: #e6edf3;
}

.pc-group-person small {
  grid-column: 2;
  color: #8b949e;
  font-size: 0.68rem;
}

.pc-click-ripple {
  position: fixed;
  z-index: 9999;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid #58a6ff;
  border-radius: 999px;
  pointer-events: none;
  color: #58a6ff;
  font-size: 0.62rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  animation: pc-click-ripple 1.1s ease-out forwards;
}

@keyframes pc-click-ripple {
  0% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.55);
  }
  100% {
    opacity: 0;
    width: 84px;
    height: 84px;
    box-shadow: 0 0 0 20px rgba(88, 166, 255, 0);
  }
}

.pc-agent-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pc-message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pc-msg-image img {
  max-width: 180px;
  max-height: 140px;
  border-radius: 8px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  object-fit: cover;
}

.pc-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 8px;
}

.pc-reaction,
.pc-react-menu button {
  border: 1px solid rgba(48, 54, 61, 0.9);
  background: #0d1117;
  color: inherit;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.72rem;
  cursor: pointer;
}

.pc-reaction.active {
  border-color: #1f6feb;
  background: rgba(31, 111, 235, 0.15);
}

.pc-react-picker {
  position: relative;
}

.pc-react-picker summary {
  list-style: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px dashed rgba(48, 54, 61, 0.9);
  color: #8b949e;
}

.pc-react-picker summary::-webkit-details-marker {
  display: none;
}

.pc-react-menu {
  position: absolute;
  bottom: 28px;
  left: 0;
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  background: #161b22;
  z-index: 3;
}

.pc-reply-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0 16px;
  padding: 8px 10px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 10px;
  background: rgba(31, 111, 235, 0.08);
  font-size: 0.74rem;
}

.pc-reply-bar.hidden,
.pc-drop-hint.hidden,
.pc-mention-menu.hidden {
  display: none;
}

.pc-drop-hint {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(88, 166, 255, 0.55);
  border-radius: 14px;
  background: rgba(1, 4, 9, 0.72);
  color: #79c0ff;
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
}

.pc-composer {
  border-top: 1px solid rgba(48, 54, 61, 0.9);
  padding: 10px 16px 14px;
}

.pc-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.pc-toolbar button,
.pc-attach-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 7px;
  background: #161b22;
  color: #c9d1d9;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
}

.pc-pending-images {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pc-pending-thumb {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pc-pending-thumb img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(48, 54, 61, 0.9);
}

.pc-input-wrap {
  position: relative;
}

#pc-input,
.pc-input {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 10px;
  background: #0d1117;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  line-height: 1.45;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
}

.pc-input:focus {
  border-color: rgba(56, 139, 253, 0.65);
  box-shadow: 0 0 0 1px rgba(56, 139, 253, 0.25);
}

.pc-input:empty:before {
  content: attr(data-placeholder);
  color: rgba(139, 148, 158, 0.9);
  pointer-events: none;
}

.pc-mention-menu {
  position: absolute;
  left: 8px;
  bottom: calc(100% + 4px);
  width: min(320px, calc(100% - 16px));
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 10px;
  background: #161b22;
  z-index: 6;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.pc-mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.pc-mention-item.active,
.pc-mention-item:hover {
  background: rgba(31, 111, 235, 0.16);
}

.pc-mention-item small {
  display: block;
  color: #8b949e;
  font-size: 0.66rem;
}

.pc-send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.pc-thread-badge {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 650;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  color: #c9d1d9;
  background: rgba(110, 118, 129, 0.18);
}

.pc-thread-badge--shared {
  border-color: rgba(56, 139, 253, 0.4);
  color: #79c0ff;
  background: rgba(31, 111, 235, 0.16);
}

.pc-thread-invite {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.9);
  background: rgba(13, 17, 23, 0.55);
}

.pc-thread-invite.hidden {
  display: none;
}

.pc-thread-invite-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pc-thread-invite-row select {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
}

.pc-thread-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pc-thread-member-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(56, 139, 253, 0.35);
  background: rgba(31, 111, 235, 0.14);
  color: #79c0ff;
  font-size: 0.72rem;
  font-weight: 600;
}

.profile-workspace-mgmt-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.92);
  max-height: min(560px, calc(100vh - 230px));
  overflow-y: auto;
}

.wm-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.wm-head > div {
  display: grid;
  gap: 2px;
}

.wm-head select,
.wm-member-row select {
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
}

.wm-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.wm-tab {
  appearance: none;
  border: 1px solid rgba(48, 54, 61, 0.95);
  background: rgba(22, 27, 34, 0.9);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  cursor: pointer;
}

.wm-tab.active {
  color: #79c0ff;
  border-color: rgba(56, 139, 253, 0.55);
  background: rgba(31, 111, 235, 0.18);
}

.wm-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.wm-stats article {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  background: rgba(22, 27, 34, 0.75);
}

.wm-stats span {
  color: var(--muted);
  font-size: 0.68rem;
}

.wm-stats strong {
  font-size: 1.05rem;
}

.wm-section {
  margin-top: 10px;
}

.wm-section h3 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 650;
}

.wm-member-list {
  display: grid;
  gap: 0;
}

.wm-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.7);
}

.wm-member-row > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.wm-role-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  font-size: 0.68rem;
  font-weight: 650;
}

.wm-role-pill--owner {
  color: #ffa657;
  border-color: rgba(210, 153, 34, 0.45);
  background: rgba(187, 128, 9, 0.16);
}

.wm-role-pill--manager {
  color: #79c0ff;
  border-color: rgba(56, 139, 253, 0.45);
  background: rgba(31, 111, 235, 0.16);
}

.wm-role-pill--user {
  color: #c9d1d9;
  background: rgba(110, 118, 129, 0.16);
}

.wm-note {
  margin-top: 12px;
}

.wm-site-link {
  display: inline-block;
  margin-top: 12px;
  color: #79c0ff;
  text-decoration: none;
  font-size: 0.82rem;
}

.wm-site-link:hover {
  text-decoration: underline;
}

@media (max-width: 820px) {
  .pc-body {
    grid-template-columns: 1fr;
  }
  .pc-threads {
    display: none;
  }
  .project-chat-panel {
    height: min(860px, calc(100vh - 24px));
  }
}

.workspace-activity-switcher {
  position: relative;
  flex-shrink: 0;
}

.workspace-activity-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: none;
  border-left: 1px solid #21262d;
  background: transparent;
  color: #e6edf3;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.workspace-activity-tab:hover {
  background: #21262d;
}

.workspace-activity-tab[aria-expanded="true"] {
  background: #21262d;
  color: #58a6ff;
}

.workspace-activity-caret {
  font-size: 0.65rem;
  color: #8b949e;
}

.workspace-activity-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  z-index: 1200;
  width: min(360px, 92vw);
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 8px;
}

.workspace-activity-dropdown .workspace-activity-list {
  max-height: min(380px, 55vh);
}

#project-chrome-hidden {
  display: none !important;
}

.workspace-tab {
  border: none;
  border-right: 1px solid transparent;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #8b949e;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.workspace-tab.active {
  color: #e6edf3;
  border-bottom-color: #388bfd;
  background: #1c2128;
}

.workspace-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#app.wiring-mode #ribbon-container,
#app.wiring-mode .toolbar-pick,
#app.wiring-mode #engineering-panel,
#app.wiring-mode .design-browser-section,
#app.wiring-mode .object-history-panel {
  display: none !important;
}

#app.wiring-mode {
  grid-template-columns: var(--left-panel-width) 6px 1fr 6px var(--right-panel-width);
}

#app.wiring-mode .auth-widget,
body.wiring-mode .auth-widget {
  margin-left: auto;
}

#app.wiring-mode.right-panel-hidden {
  grid-template-columns: var(--left-panel-width) 6px 1fr 0px 0px;
}

#app.wiring-mode.left-panel-hidden {
  grid-template-columns: 0px 0px 1fr 6px var(--right-panel-width);
}

#app.wiring-mode.left-panel-hidden.right-panel-hidden {
  grid-template-columns: 0px 0px 1fr 0px 0px;
}

#app.wiring-mode .sidebar.right {
  display: flex !important;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

#app.wiring-mode .right-panel-tabs .right-panel-tab:not(.wiring-mode-tab) {
  display: none;
}

#app.wiring-mode .right-panel-tabs {
  grid-template-columns: 1fr;
}

#app.wiring-mode .wiring-mode-tab {
  display: block;
}

.wiring-mode-tab {
  display: none;
}

#app.wiring-mode [data-right-panel]:not([data-right-panel="wiring"]) {
  display: none !important;
}

#app.wiring-mode [data-right-panel="wiring"] {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  gap: 8px;
}

.wiring-driver-link-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wiring-driver-link-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.82rem;
}

.wiring-driver-link-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}

#app.wiring-mode #viewport,
#app.wiring-mode .gizmo-panel,
#app.wiring-mode .view-cube {
  display: none !important;
}

#app.wiring-mode #wiring-workspace,
body.wiring-mode #wiring-workspace {
  display: flex !important;
}

#app.wiring-mode .main-column,
body.wiring-mode .main-column {
  min-height: 0;
}

#app.wiring-mode #wiring-workspace.hidden,
body.wiring-mode #wiring-workspace.hidden {
  display: none !important;
}

#app.wiring-mode .sidebar.right [data-right-panel="tools"],
#app.wiring-mode .edit-panel {
  display: none;
}

/* ── Canvas design tab (2D grid sketch pad) ─────────────────────────────── */

#app.canvas-design-tab #viewport,
#app.canvas-design-tab .gizmo-panel,
#app.canvas-design-tab .view-cube,
#app.canvas-design-tab .viewport-view-bar,
#app.canvas-design-tab .viewport-lighting-tab,
#app.canvas-design-tab .mobile-showcase-bar,
#app.canvas-design-tab #sketch-chrome {
  display: none !important;
}

#app.canvas-design-tab #canvas-workspace,
body.canvas-design-tab #canvas-workspace {
  display: flex !important;
  flex: 1;
  min-height: 0;
}

#app.canvas-design-tab .main-column,
body.canvas-design-tab .main-column {
  min-height: 0;
}

.canvas-workspace-wrap {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
  background: #0d1117;
  position: relative;
}

.canvas-generation-banner {
  flex-shrink: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(88, 166, 255, 0.35);
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.16), rgba(88, 166, 255, 0.06));
}

.canvas-generation-banner.hidden {
  display: none !important;
}

.canvas-generation-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 14px;
}

.canvas-generation-message {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  color: #c9d1d9;
}

.canvas-generation-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(88, 166, 255, 0.25);
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: canvas-gen-spin 0.8s linear infinite;
}

.canvas-generation-banner--v2 {
  border-bottom-color: rgba(212, 160, 23, 0.38);
  background: linear-gradient(180deg, rgba(212, 160, 23, 0.16), rgba(212, 160, 23, 0.06));
}

.canvas-generation-banner--v2 .canvas-generation-spinner {
  border-color: rgba(212, 160, 23, 0.22);
  border-top-color: #d4a017;
  border-right-color: rgba(212, 160, 23, 0.55);
  box-shadow: 0 0 12px rgba(212, 160, 23, 0.28);
}

.canvas-generation-banner--fusion {
  border-bottom-color: rgba(56, 189, 248, 0.42);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.18), rgba(8, 47, 73, 0.08));
}

.canvas-generation-banner--fusion .canvas-generation-spinner {
  border-color: rgba(56, 189, 248, 0.22);
  border-top-color: #7dd3fc;
  border-right-color: rgba(56, 189, 248, 0.62);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.32);
}

@keyframes canvas-gen-spin {
  to { transform: rotate(360deg); }
}

.canvas-mode-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-area {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(88, 166, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.08) 1px, transparent 1px),
    #0d1117;
  background-size: 20px 20px, 20px 20px, auto;
}

.canvas-draw {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.canvas-tag-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.canvas-tag-badge {
  position: absolute;
  pointer-events: auto;
  max-width: 128px;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(88, 166, 255, 0.58);
  border-radius: 999px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.2), transparent 52%),
    rgba(13, 17, 23, 0.92);
  color: #a5d6ff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 24px rgba(1, 4, 9, 0.34), 0 0 0 2px rgba(88, 166, 255, 0.08);
}

.canvas-tag-badge::before {
  content: "#";
  color: #58a6ff;
  margin-right: 3px;
}

.canvas-tag-menu {
  position: fixed;
  z-index: 15020;
  width: 210px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(88, 166, 255, 0.36);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98));
  color: #e6edf3;
  box-shadow: 0 18px 48px rgba(1, 4, 9, 0.52);
}

.canvas-tag-menu strong,
.canvas-tag-menu span {
  display: block;
}

.canvas-tag-menu strong {
  font-size: 0.86rem;
}

.canvas-tag-menu > span {
  color: #8b949e;
  font-size: 0.72rem;
  line-height: 1.35;
}

.canvas-tag-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.canvas-tag-options button {
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #c9d1d9;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.canvas-tag-options button:hover {
  border-color: rgba(88, 166, 255, 0.58);
  background: rgba(56, 139, 253, 0.14);
  color: #f0f6fc;
}

.canvas-toolbar-popup {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(13, 17, 23, 0.94);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
}

.canvas-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.canvas-tool-sep {
  width: 1px;
  height: 24px;
  background: rgba(48, 54, 61, 0.9);
  margin: 0 2px;
}

.canvas-tool-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1;
}

.canvas-tool-btn:hover {
  background: rgba(48, 54, 61, 0.8);
  border-color: rgba(88, 166, 255, 0.25);
}

.canvas-tool-btn.active {
  background: rgba(31, 111, 235, 0.22);
  border-color: rgba(88, 166, 255, 0.55);
  color: #79c0ff;
}

.canvas-color-pick {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.canvas-preset-colors {
  display: flex;
  gap: 4px;
}

.canvas-preset {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0;
  cursor: pointer;
}

.canvas-stroke-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.canvas-stroke-range {
  width: 72px;
}

.canvas-text-input {
  position: absolute;
  z-index: 30;
  min-width: 120px;
  min-height: 28px;
  padding: 4px 6px;
  border: 1px dashed rgba(88, 166, 255, 0.65);
  border-radius: 4px;
  background: rgba(13, 17, 23, 0.88);
  resize: both;
  outline: none;
}

.canvas-voice-bar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.canvas-voice-btn {
  border: 1px solid var(--border);
  background: #161b22;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  cursor: pointer;
}

.canvas-voice-btn.recording {
  border-color: #f85149;
  color: #ff7b72;
  background: rgba(248, 81, 73, 0.12);
}

.canvas-voice-timer {
  font-size: 0.82rem;
  color: #ff7b72;
}

.canvas-transcript {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  #app.canvas-design-tab {
    grid-template-rows: 44px 1fr !important;
  }

  #app.canvas-design-tab .sidebar.right {
    display: none !important;
  }

  .canvas-toolbar-popup {
    top: auto;
    bottom: 72px;
    max-width: calc(100% - 16px);
    padding: 6px 8px;
  }

  .canvas-tool-btn {
    padding: 8px 10px;
  }

  .canvas-voice-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
  }
}

.wiring-prompt-panel textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.82rem;
}

.wiring-panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  padding-bottom: 4px;
  margin: -4px 0 0;
}

.design-browser-root {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0d1117;
  overflow: hidden;
  min-height: 120px;
  max-height: 420px;
  overflow-y: auto;
}

.design-browser-section {
  margin-bottom: 12px;
}

.design-browser-header {
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #161b22;
}

.browser-section-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: #c9d1d9;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: left;
}

.browser-section-toggle:hover {
  background: #21262d;
}

.browser-chevron {
  width: 12px;
  color: #8b949e;
  font-size: 0.7rem;
}

.browser-section-count {
  margin-left: auto;
  font-size: 0.68rem;
  color: #8b949e;
}

.browser-item-list {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
}

.browser-child-group {
  list-style: none;
}

.browser-child-group-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 18px);
  margin-left: 18px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: #8b949e;
  font-size: 0.74rem;
  cursor: pointer;
  text-align: left;
}

.browser-child-group-toggle:hover {
  background: #21262d;
  color: #c9d1d9;
}

.browser-item-list--children {
  padding-left: 18px;
}

.browser-body-icon {
  font-size: 0.55rem;
  color: #8b949e;
  margin-right: 4px;
}

.browser-item--child .browser-item-name {
  font-size: 0.72rem;
  color: #c9d1d9;
}

.browser-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 18px;
  border-left: 3px solid transparent;
}

.browser-item--child {
  padding-left: 24px;
  color: #9da7b3;
}

.fusion-import-bodies-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted, #8b949e);
  font-size: 0.78rem;
}

.browser-item:hover {
  background: #21262d;
}

.browser-item--draggable {
  cursor: grab;
}

.browser-item--draggable:active {
  cursor: grabbing;
}

.browser-item.active {
  background: #388bfd18;
  border-left-color: #388bfd;
}

.browser-item--selected {
  background: rgba(31, 111, 235, 0.16);
  outline: 1px solid rgba(88, 166, 255, 0.55);
}

.browser-vis-btn,
.browser-item-body {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 4px;
}

.browser-vis-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8b949e;
  border-radius: 5px;
  opacity: 0.95;
}

.browser-vis-btn:hover {
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.12);
}

.browser-vis-btn.is-hidden {
  color: #6e7681;
  opacity: 0.7;
}

.browser-item.hidden-component .browser-item-body {
  opacity: 0.46;
}

.browser-item.hidden-component .browser-item-name {
  text-decoration: line-through;
  text-decoration-color: rgba(139, 148, 158, 0.7);
}

.browser-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.browser-item-body {
  text-align: left;
  overflow: hidden;
  min-width: 0;
}

.browser-item-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.browser-item-badge {
  display: inline-block;
  margin-top: 2px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.6rem;
  line-height: 1.5;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  color: #8dd2ff;
  background: rgba(31, 111, 235, 0.18);
  border: 1px solid rgba(88, 166, 255, 0.4);
}

.wiring-part--sourced {
  outline: 1px dashed rgba(141, 210, 255, 0.5);
  outline-offset: 1px;
}

.browser-item-actions {
  display: none;
  gap: 2px;
}

.browser-item:hover .browser-item-actions {
  display: flex;
}

.browser-item-actions--profile-visible {
  display: flex;
}

.browser-item-actions--profile-visible .browser-action-btn:not(.browser-action-profile) {
  display: none;
}

.browser-item:hover .browser-item-actions--profile-visible .browser-action-btn {
  display: inline-flex;
}

.browser-action-btn {
  border: none;
  background: #30363d;
  color: #c9d1d9;
  font-size: 0.62rem;
  padding: 2px 5px;
  border-radius: 3px;
  cursor: pointer;
}

.browser-action-btn.danger {
  color: #ff7b72;
}

.browser-empty-item {
  padding: 6px 12px 8px 28px;
}

.viewport-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 23, 0.72);
  pointer-events: none;
}

.viewport-drop-overlay:not(.hidden) {
  pointer-events: none;
}

#viewport.viewport-drag-over .viewport-drop-overlay,
#app.workspace-drag-over #viewport .viewport-drop-overlay {
  display: flex;
}

#viewport.viewport-drag-over .viewport-drop-card,
#app.workspace-drag-over #viewport .viewport-drop-card {
  border-color: #388bfd;
  box-shadow: 0 0 0 2px #388bfd55;
}

.viewport-drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 40px;
  border: 2px dashed #484f58;
  border-radius: 12px;
  background: #161b22ee;
  color: #e6edf3;
}

.wiring-workspace {
  flex: 1;
  display: none;
  min-height: 0;
  min-width: 0;
  background: #0d1117;
  flex-direction: row;
}

#app.rigging-design-tab .viewport-hint {
  border-color: #f0883e;
  top: 12px;
}

#app.rigging-design-tab .viewport-generation-user {
  top: 12px;
  z-index: 48;
}

/* Keep project history timeline available; anim bar sits above it in the viewport */
#app.rigging-design-tab .timeline-expand-tab {
  display: none !important;
}

#app.rigging-design-tab .rigging-mode-tab {
  display: block;
}

.rigging-mode-tab {
  display: none;
}

#app.rigging-design-tab #rigging-chrome:not(.hidden) {
  display: block;
}

#rigging-chrome.solid-adjust-chrome {
  display: block;
}

#rigging-chrome.solid-adjust-chrome .rigging-viewport-manage,
#rigging-chrome.solid-adjust-chrome #rigging-anim-panel {
  display: none !important;
}

#app.rigging-design-tab #viewport {
  cursor: default;
}

/* ── Clean viewport rigging overlay (no orange toolbelt) ──────────────────── */
.rigging-chrome {
  position: absolute;
  inset: 0;
  z-index: 46;
  pointer-events: none;
  display: none;
}

.rigging-chrome.hidden {
  display: none !important;
}

.rigging-viewport-manage {
  pointer-events: auto;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  width: min(280px, calc(100% - 24px));
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.88);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.rigging-manage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.75);
}

.rigging-manage-head strong {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e6edf3;
}

.rigging-manage-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.9);
  color: #8b949e;
  cursor: pointer;
}

.rigging-manage-body {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}

.rigging-viewport-manage.is-collapsed .rigging-manage-body {
  display: none;
}

.rigging-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rigging-manage-row {
  display: grid;
  gap: 4px;
  font-size: 0.72rem;
  color: #8b949e;
}

.rigging-manage-row select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #e6edf3;
}

.rigging-manage-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: #c9d1d9;
}


.rigging-toolbelt {
  display: none !important;
}

.rigging-anim-panel {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  top: 12px;
  bottom: auto;
  width: min(980px, calc(100% - 32px));
  transform: translateX(-50%);
  z-index: 22;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  padding: 8px 10px;
}

#app.rigging-design-tab #timeline-panel {
  /* Project history stays available under the viewport column */
  display: block;
}

#app.rigging-design-tab .viewport-hint {
  border-color: #f0883e;
  top: 12px;
}

/* legacy toolbelt tokens kept for any residual buttons */
.rigging-tool-group {
  display: none;
}

.rigging-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid #30363d;
  border-radius: 5px;
  background: #21262d;
  color: #e6edf3;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.rigging-tool-btn:hover {
  background: #3d2e20;
  border-color: #f0883e;
}

.rigging-tool-btn.active {
  background: #f0883e22;
  border-color: #f0883e;
  color: #ffb366;
}

.rigging-tool-btn.rigging-tool-accent {
  background: #b45309;
  border-color: #f0883e;
  color: #fff;
}

.rigging-tool-btn.rigging-tool-accent:hover {
  background: #d97706;
}

.rigging-tool-sep {
  width: 1px;
  height: 22px;
  background: #5c3d1e;
  margin: 0 4px;
  flex-shrink: 0;
}

.rigging-anim-panel {
  /* Layout owned by the clean viewport overlay rule above. */
}

.rigging-anim-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rigging-anim-transport {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rigging-anim-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: #21262d;
  color: #e6edf3;
  font-size: 0.72rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rigging-anim-btn:hover {
  background: #30363d;
  border-color: #f0883e;
}

.rigging-anim-btn.rigging-anim-play {
  width: auto;
  padding: 0 10px;
  font-weight: 700;
}

.rigging-anim-btn.rigging-anim-key {
  width: auto;
  padding: 0 10px;
  margin-left: auto;
  color: #f0883e;
  border-color: #5c3d1e;
}

.rigging-anim-btn.rigging-anim-collapse {
  width: 28px;
  margin-left: auto;
}

.rigging-anim-btn.rigging-anim-collapse + .rigging-anim-key {
  margin-left: 0;
}

.rigging-anim-timeline.is-collapsed {
  gap: 0;
}

.rigging-anim-timeline.is-collapsed .rigging-anim-scrub,
.rigging-anim-timeline.is-collapsed .rigging-anim-meta,
.rigging-anim-timeline.is-collapsed .rigging-anim-key,
.rigging-anim-timeline.is-collapsed [data-action="prev-key"],
.rigging-anim-timeline.is-collapsed [data-action="next-key"] {
  display: none;
}

.rigging-anim-time,
.rigging-anim-frame {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: #8b949e;
  margin-left: 4px;
}

.rigging-anim-scrub {
  position: relative;
  height: 22px;
}

.rigging-anim-scrub input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #f0883e;
}

.rigging-anim-markers {
  position: absolute;
  inset: 0 0 auto 0;
  height: 22px;
  pointer-events: none;
}

.rigging-anim-marker {
  position: absolute;
  top: 2px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: #f0883e;
  box-shadow: 0 0 0 1px #161b22;
}

.rigging-anim-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rigging-anim-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: #e6edf3;
}

.rigging-prompt-panel .prompt-panel-tabs {
  margin-bottom: 10px;
}

.rigging-prompt-tab {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #21262d;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.rigging-prompt-tab.active {
  background: #f0883e22;
  color: #f0883e;
  border-color: #f0883e;
}

.rigging-prompt-tab:first-child {
  border-radius: 6px 0 0 6px;
}

.rigging-prompt-tab:last-child {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.rigging-prompt-image-drop {
  border: 1px dashed #484f58;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  margin: 8px 0;
}

.rigging-prompt-image-drop:hover {
  border-color: #f0883e;
  color: #f0883e;
}

.rigging-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rigging-panel-head h2 {
  margin: 0;
  color: #f0883e;
}

#app.sketch-editing #viewport {
  cursor: crosshair;
  box-shadow: inset 0 0 0 1px rgba(0, 102, 204, 0.35);
}

#app.sketch-editing .view-cube,
#app.sketch-editing .viewport-view-bar,
#app.sketch-editing .viewport-lighting-tab {
  display: none;
}

#app.sketch-editing .toolbar-pick {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Fusion 360 sketch environment chrome ─────────────────────────────────── */
.sketch-chrome {
  position: absolute;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sketch-chrome.hidden {
  display: none;
}

.sketch-top-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 14px;
  background: linear-gradient(180deg, #fafafa 0%, #ececec 100%);
  border-bottom: 1px solid #c4c4c4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.sketch-top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sketch-pencil-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #0066cc linear-gradient(145deg, #1a7fe6, #0052a3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  position: relative;
  flex-shrink: 0;
}

.sketch-pencil-icon::after {
  content: "";
  position: absolute;
  inset: 7px 8px 7px 10px;
  border-left: 2px solid #fff;
  transform: rotate(-35deg);
  transform-origin: bottom left;
  opacity: 0.95;
}

.sketch-top-bar-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sketch-top-bar-titles strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.01em;
}

.sketch-top-bar-titles span {
  font-size: 0.68rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sketch-top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sketch-btn {
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.sketch-btn--ghost {
  background: #fff;
  border-color: #bdbdbd;
  color: #444;
}

.sketch-btn--ghost:hover {
  background: #f5f5f5;
  border-color: #999;
}

.sketch-btn--finish {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #3d9a47 0%, #2d7a35 100%);
  border-color: #256b2c;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.sketch-btn--finish:hover {
  background: linear-gradient(180deg, #47ad52 0%, #32853c 100%);
}

.sketch-finish-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
  font-weight: 800;
}

.sketch-quick-tools {
  pointer-events: auto;
  position: absolute;
  top: 58px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #c8c8c8;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.sketch-quick-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  background: #f8f8f8;
  color: #333;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.sketch-quick-btn:hover {
  background: #fff;
  border-color: #0066cc;
  color: #0066cc;
}

.sketch-quick-btn.active {
  background: #e8f2fc;
  border-color: #0066cc;
  color: #0066cc;
  box-shadow: inset 0 0 0 1px rgba(0, 102, 204, 0.25);
}

.sketch-quick-btn--dimension {
  background: #fff7e6;
  border-color: #d29922;
  color: #8a5a00;
}

.sketch-quick-sep {
  display: block;
  width: 100%;
  height: 1px;
  margin: 3px 0;
  background: #d8d8d8;
}

.sketch-status-bar {
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: linear-gradient(0deg, #ececec 0%, #f6f6f6 100%);
  border-top: 1px solid #c4c4c4;
  font-size: 0.72rem;
  color: #444;
}

.sketch-status-tool {
  font-weight: 700;
  color: #0066cc;
  text-transform: capitalize;
  min-width: 64px;
}

.sketch-status-sep {
  color: #bbb;
}

.sketch-status-hint {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #555;
}

.sketch-status-hint--error {
  color: #c62828;
  font-weight: 600;
}

.sketch-status-stats {
  margin-left: auto;
  color: #777;
  font-variant-numeric: tabular-nums;
}

.sketch-inspector-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 12px 0;
  font-size: 0.78rem;
}

.sketch-inspector-meta dt {
  color: var(--muted);
  font-weight: 600;
}

.sketch-inspector-meta dd {
  margin: 0;
  color: #e6edf3;
}

.sketch-inspector-hint {
  margin: 0 0 12px;
  line-height: 1.45;
}

.sketch-inspector-actions {
  display: grid;
  gap: 8px;
}

.sketch-prompt-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #ddd);
  display: grid;
  gap: 8px;
}

.sketch-prompt-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.sketch-prompt-block textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
}

#app.sketch-design-tab .viewport-hint {
  border-color: #0066cc;
}

.ribbon-bar.ribbon-bar--sketch .ribbon-tab.active {
  border-bottom-color: #0066cc;
}

#app.sketch-editing .ribbon-bar {
  background: #f3f3f3;
  border-bottom-color: #c8c8c8;
}

#app.sketch-editing .ribbon-toggle-row {
  background: #ebebeb;
  border-bottom-color: #d4d4d4;
}

#app.sketch-editing .ribbon-body {
  background: #f3f3f3;
}

#app.sketch-editing .ribbon-tab {
  color: #555;
}

#app.sketch-editing .ribbon-tab.active {
  color: #1a1a1a;
  background: #fff;
  border-bottom-color: #0066cc;
}

#app.sketch-editing .ribbon-btn {
  color: #333;
}

#app.sketch-editing .ribbon-btn:hover {
  background: #fff;
  border-color: #bdbdbd;
}

#app.sketch-editing .ribbon-btn.ribbon-btn--active {
  background: #e8f2fc;
  border-color: #0066cc;
  color: #0066cc;
}

#app.sketch-editing .rb-label {
  color: #444;
}

.ribbon-bar.ribbon-bar--rigging .ribbon-tab.active {
  border-bottom-color: #f0883e;
}

.wiring-palette {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
  background: #161b22;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wiring-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.wiring-content-area {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.wiring-content-area.debug-open {
  flex-direction: row;
}

.wiring-content-area.debug-open #wiring-viewport {
  flex: 1 1 58%;
  min-width: 0;
}

.wiring-content-area.debug-open #wiring-debug-panel {
  flex: 1 1 42%;
  min-width: 280px;
  max-width: 520px;
}

/* ── Circuit Debugger panel ──────────────────────────────────────────────── */
.wiring-tool-btn.wiring-tool-debug.active {
  border-color: #a371f7;
  background: rgba(163, 113, 247, 0.18);
  color: #d2a8ff;
}

.wiring-debug-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-left: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
}

.wiring-debug-panel[hidden] {
  display: none !important;
}

.wiring-debug-panel.drag-over {
  box-shadow: inset 0 0 0 2px rgba(163, 113, 247, 0.45);
}

.wdbg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #161b22;
  flex-shrink: 0;
}

.wdbg-header-left,
.wdbg-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.wdbg-key-pill {
  font-size: 0.72rem;
  padding: 4px 8px;
  max-width: min(200px, 42vw);
  flex-shrink: 1;
}

.wdbg-key-pill .prompt-key-pill-name {
  max-width: 72px;
}

.wdbg-key-pill .prompt-key-pill-model {
  max-width: 88px;
}

.wdbg-icon {
  font-size: 1rem;
}

.wdbg-title {
  font-size: 0.86rem;
  font-weight: 700;
}

.wdbg-session-cost {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(63, 185, 80, 0.12);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.28);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.wdbg-schematic-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.14);
  color: #79c0ff;
  border: 1px solid rgba(88, 166, 255, 0.28);
  white-space: nowrap;
}

.wdbg-hdr-btn {
  border: 1px solid var(--border);
  background: #21262d;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.74rem;
  cursor: pointer;
}

.wdbg-hdr-btn:hover {
  color: var(--text);
  border-color: #484f58;
}

.wdbg-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wdbg-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  text-align: center;
  color: var(--muted);
}

.wdbg-welcome-icon {
  font-size: 1.6rem;
}

.wdbg-welcome-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.wdbg-welcome-body {
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: 320px;
}

.wdbg-welcome-tips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.wdbg-welcome-tips span {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.wdbg-composer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: #161b22;
}

.wdbg-photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.wdbg-photo-row:empty {
  display: none;
}

.wdbg-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.wdbg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wdbg-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.62rem;
  cursor: pointer;
  line-height: 1;
}

.wdbg-photo-add-row {
  display: flex;
  gap: 6px;
}

.wdbg-add-photo-btn {
  border: 1px solid var(--border);
  background: #21262d;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}

.wdbg-add-photo-btn:hover {
  border-color: #484f58;
  background: #30363d;
}

.wdbg-text-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  font-size: 0.82rem;
  resize: vertical;
}

.wdbg-text-input:focus {
  outline: none;
  border-color: rgba(163, 113, 247, 0.55);
  box-shadow: 0 0 0 3px rgba(163, 113, 247, 0.12);
}

.wdbg-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.wdbg-speed-toggle {
  margin-left: auto;
}

.wdbg-send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wdbg-schematic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
}

.wdbg-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(163, 113, 247, 0.45);
  background: rgba(163, 113, 247, 0.18);
  color: #d2a8ff;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.wdbg-send-btn:hover:not(:disabled) {
  background: rgba(163, 113, 247, 0.28);
}

.wdbg-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wdbg-msg {
  max-width: 100%;
  font-size: 0.8rem;
  line-height: 1.45;
}

.wdbg-msg-user {
  align-self: flex-end;
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 10px 10px 4px 10px;
  background: rgba(31, 111, 235, 0.18);
  border: 1px solid rgba(88, 166, 255, 0.28);
}

.wdbg-msg-ai {
  align-self: stretch;
  padding: 10px 12px;
  border-radius: 10px;
  background: #161b22;
  border: 1px solid var(--border);
}

.wdbg-msg-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.wdbg-msg-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.wdbg-msg-photo-missing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  padding: 4px;
  font-size: 0.62rem;
  line-height: 1.2;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.wdbg-msg-loading,
.wdbg-msg-error {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wdbg-cancel-btn {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid rgba(248, 81, 73, 0.45);
  background: rgba(248, 81, 73, 0.12);
  color: #f85149;
  cursor: pointer;
}

.wdbg-cancel-btn:hover {
  background: rgba(248, 81, 73, 0.22);
}

.wdbg-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(163, 113, 247, 0.25);
  border-top-color: #a371f7;
  border-radius: 50%;
  animation: wdbg-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes wdbg-spin {
  to { transform: rotate(360deg); }
}

.wdbg-banner {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.wdbg-banner-danger {
  background: rgba(248, 81, 73, 0.14);
  border: 1px solid rgba(248, 81, 73, 0.35);
  color: #ff7b72;
}

.wdbg-banner-warn {
  background: rgba(210, 153, 34, 0.14);
  border: 1px solid rgba(210, 153, 34, 0.35);
  color: #e3b341;
}

.wdbg-banner-ok {
  background: rgba(63, 185, 80, 0.14);
  border: 1px solid rgba(63, 185, 80, 0.35);
  color: #7ee787;
}

.wdbg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.wdbg-pill {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.wdbg-pill-error { background: rgba(248, 81, 73, 0.18); color: #ff7b72; }
.wdbg-pill-warning { background: rgba(210, 153, 34, 0.18); color: #e3b341; }
.wdbg-pill-info { background: rgba(88, 166, 255, 0.18); color: #79c0ff; }

.wdbg-overall {
  font-size: 0.78rem;
  color: var(--text);
  margin-bottom: 10px;
}

.wdbg-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 10px 0 6px;
  font-weight: 700;
}

.wdbg-issue {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}

.wdbg-issue-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  background: #21262d;
}

.wdbg-issue-hdr:hover {
  background: #30363d;
}

.wdbg-sev-badge {
  font-size: 0.66rem;
  font-weight: 700;
  white-space: nowrap;
}

.wdbg-issue-title {
  flex: 1;
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 600;
}

.wdbg-chev {
  color: var(--muted);
  font-size: 0.68rem;
}

.wdbg-issue-body {
  display: none;
  padding: 8px 10px 10px;
  font-size: 0.76rem;
  border-top: 1px solid var(--border);
}

.wdbg-issue-body.open {
  display: block;
}

.wdbg-issue-desc {
  color: var(--text);
  margin-bottom: 6px;
}

.wdbg-issue-loc {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 6px;
}

.wdbg-fix-box {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.28);
  color: #7ee787;
  font-size: 0.74rem;
}

.wdbg-correct-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.76rem;
  color: var(--muted);
}

.wdbg-detected {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wdbg-tag {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
}

.wdbg-focus-caption {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 8px;
  line-height: 1.45;
}

.wdbg-focus-diagram-slot {
  width: 100%;
  min-height: 220px;
  margin: 0 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d1117;
  overflow: hidden;
}

.wdbg-focus-diagram-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

.wdbg-focus-diagram-slot .wdbg-focus-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 180px;
  max-height: 320px;
}

.wdbg-focus-wire-badge {
  fill: rgba(13, 17, 23, 0.95);
  stroke: #484f58;
  stroke-width: 1.5;
}

.wdbg-focus-wire-badge--issue {
  stroke: #f85149;
  fill: rgba(248, 81, 73, 0.15);
}

.wdbg-focus-wire-badge-text {
  fill: #e6edf3;
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-anchor: middle;
  pointer-events: none;
}

.wdbg-focus-pin-dot {
  stroke: #0d1117;
  stroke-width: 1;
}

.wdbg-focus-wire-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: #f85149;
  border: 1.5px solid rgba(248, 81, 73, 0.65);
  background: rgba(248, 81, 73, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wdbg-focus-label-bg {
  fill: rgba(13, 17, 23, 0.92);
  stroke: rgba(48, 54, 61, 0.9);
  stroke-width: 1;
}

.wdbg-focus-wire-label,
.wdbg-focus-part-label {
  fill: #e6edf3;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-anchor: middle;
  pointer-events: none;
}

.wdbg-focus-part-inline {
  fill: #c9d1d9;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-anchor: middle;
  pointer-events: none;
}

.wdbg-focus-part-label {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
}

.wdbg-focus-wire-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wdbg-focus-wire-legend li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #e6edf3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wdbg-focus-wire-swatch {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.wdbg-focus-bb-rail-plus {
  stroke: #f85149;
  stroke-width: 2;
  opacity: 0.85;
}

.wdbg-focus-bb-rail-minus {
  stroke: #6e7681;
  stroke-width: 2;
  opacity: 0.85;
}

.wdbg-focus-diagram--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 16px;
}

.wdbg-apply-focus-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px 10px;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(88, 166, 255, 0.12);
  color: #79c0ff;
  cursor: pointer;
}

.wdbg-apply-focus-btn:hover {
  background: rgba(88, 166, 255, 0.22);
}

.wdbg-camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.wdbg-camera-modal {
  width: min(480px, 96vw);
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.wdbg-camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.wdbg-camera-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.wdbg-cam-video {
  display: block;
  width: 100%;
  max-height: 50vh;
  background: #000;
}

.wdbg-camera-actions {
  padding: 10px 12px;
}

.wdbg-camera-hint {
  padding: 0 12px 12px;
  font-size: 0.74rem;
  color: var(--muted);
  text-align: center;
}

#app.wiring-mode #wiring-workspace:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

#app.wiring-mode #wiring-viewport {
  flex: 1 1 auto;
  min-height: 120px;
}

.wiring-toolbelt {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: #1c2128;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.wiring-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #21262d;
  color: #e6edf3;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.wiring-tool-btn:hover:not(:disabled) {
  background: #30363d;
  border-color: #484f58;
}

.wiring-tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wiring-tool-btn.wiring-tool-accent {
  background: #238636;
  border-color: #2ea043;
  color: #fff;
}

.wiring-tool-btn.wiring-tool-accent:hover:not(:disabled) {
  background: #2ea043;
}

.wiring-tool-btn.wiring-tool-danger {
  background: rgba(248, 81, 73, 0.18);
  border-color: rgba(248, 81, 73, 0.55);
  color: #ffaba8;
}

.wiring-tool-btn.wiring-tool-danger:hover:not(:disabled) {
  background: rgba(248, 81, 73, 0.28);
}

.wiring-tool-sep {
  width: 1px;
  height: 22px;
  background: #30363d;
  margin: 0 4px;
  flex-shrink: 0;
}

.wiring-prompt-panel .prompt-panel-tabs {
  margin-bottom: 10px;
}

.wiring-prompt-tab {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #21262d;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.wiring-prompt-tab.active {
  background: #388bfd22;
  color: #58a6ff;
  border-color: #388bfd;
}

.wiring-prompt-tab:first-child {
  border-radius: 6px 0 0 6px;
}

.wiring-prompt-tab:last-child {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.wiring-prompt-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

.wiring-prompt-section h3 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.wiring-prompt-section textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  font-size: 0.78rem;
}

.wiring-prompt-image-drop {
  border: 1px dashed #30363d;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 8px;
}

.wiring-prompt-image-drop:hover {
  border-color: #388bfd;
  color: var(--text);
}

.wiring-prompt-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* ── Wiring generate row: key pill + generate/stop side-by-side ── */
.wiring-generate-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.wiring-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.wiring-speed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.92);
  font-size: 0.78rem;
  color: var(--muted);
}

.wiring-speed-toggle select {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0d1117;
  color: var(--text);
  padding: 4px 8px;
  font-size: 0.78rem;
}

.wiring-mode-hint {
  flex: 1 1 140px;
  min-width: 0;
  line-height: 1.3;
}

.wiring-toolbelt-mode-wrap {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.wiring-toolbelt-mode {
  height: 28px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 6px;
  background: rgba(13, 17, 23, 0.92);
  color: var(--text);
  padding: 0 8px;
  font-size: 0.72rem;
  cursor: pointer;
}

.wiring-toolbelt-mode:focus {
  outline: none;
  border-color: rgba(88, 166, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.25);
}

.wiring-key-pill {
  flex-shrink: 0;
  max-width: 160px;
}

/* Slot: Generate and Stop occupy the same space — only one visible at a time */
.wiring-btn-slot {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.wiring-btn-slot > * {
  grid-column: 1;
  grid-row: 1;
}

.wiring-generate-btn {
  width: 100%;
  white-space: nowrap;
}

/* ── Secondary action row ── */
.wiring-secondary-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.wiring-action-btn {
  flex: 1 1 auto;
  font-size: 0.8rem;
}

/* ── Demo presets as compact chips ── */
.wiring-demo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
}

.wiring-demo-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  flex-shrink: 0;
  margin-right: 2px;
}

.wiring-demo-chip {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.73rem;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  white-space: nowrap;
}

.wiring-demo-chip:hover {
  border-color: rgba(88, 166, 255, 0.5);
  color: var(--text);
  background: rgba(88, 166, 255, 0.08);
}

.wiring-prompt-image-list img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #30363d;
}

.wiring-viewport {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.wiring-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.wiring-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #161b22;
}

.wiring-toolbar-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.wiring-toolbar-hint {
  margin-left: auto;
}

.wiring-color-picks {
  display: flex;
  gap: 4px;
}

.wiring-color-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.wiring-color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 0 1px #388bfd;
}

.wiring-canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

.wiring-ref-image {
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
  opacity: 0.22;
}

.wiring-ref-image.hidden {
  display: none;
}

.wiring-notes {
  position: absolute;
  right: 12px;
  bottom: 12px;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.92);
  font-size: 0.72rem;
  color: var(--muted);
  z-index: 5;
}

.wiring-notes-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.wiring-notes-toggle span {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(33, 38, 45, 0.85);
}

.wiring-notes-toggle:hover span {
  color: #fff;
  border-color: var(--accent);
}

.wiring-notes.hidden {
  display: none;
}

.wiring-notes.collapsed .wiring-notes-body {
  display: none;
}

.wiring-notes-body {
  margin-top: 8px;
}

.wiring-notes-desc {
  margin: 0 0 8px;
  color: var(--text);
}

.wiring-notes ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.wiring-requirements {
  position: absolute;
  top: 72px;
  right: 12px;
  z-index: 6;
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 128px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 14px;
  background: rgba(13, 17, 23, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.wiring-requirements.collapsed {
  width: auto;
}

.wiring-requirements-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.22), rgba(13, 17, 23, 0.94));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.wiring-requirements-toggle strong {
  flex: 1;
  font-size: 0.78rem;
}

.wiring-req-tab {
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 999px;
  padding: 2px 7px;
  color: #9ecbff;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.wiring-requirements.collapsed .wiring-requirements-toggle strong,
.wiring-requirements.collapsed .wiring-requirements-body {
  display: none;
}

.wiring-requirements.collapsed .wiring-requirements-toggle {
  writing-mode: vertical-rl;
  padding: 12px 8px;
}

.wiring-requirements-body {
  overflow: auto;
  padding: 10px;
}

.wiring-req-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.wiring-req-badges span {
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--muted);
  background: rgba(33, 38, 45, 0.72);
  font-size: 0.66rem;
  font-weight: 700;
}

.wiring-req-item {
  border-left: 3px solid #58a6ff;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 8px 0;
  background: rgba(22, 27, 34, 0.86);
}

.wiring-req-item--warn {
  border-left-color: #d29922;
}

.wiring-req-item--ok {
  border-left-color: #3fb950;
}

.wiring-req-item h4 {
  margin: 0 0 4px;
  font-size: 0.74rem;
}

.wiring-req-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.wiring-wire-context-menu {
  position: absolute;
  z-index: 12;
  min-width: 220px;
  padding: 6px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.wiring-wire-context-menu.hidden {
  display: none;
}

.wiring-wire-context-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.wiring-wire-context-menu button:hover {
  background: rgba(88, 166, 255, 0.16);
}

.wiring-prompt-section .btn.full + .btn.full {
  margin-top: 8px;
}

.wiring-palette h3 {
  margin: 0 0 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.wiring-palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #21262d;
  font-size: 0.78rem;
  cursor: grab;
  user-select: none;
}

.wiring-palette-icon {
  width: 28px;
  height: 20px;
  border-radius: 3px;
  flex-shrink: 0;
  background: #30363d;
}

.wiring-icon-arduino { background: linear-gradient(135deg, #00979d, #006d72); }
.wiring-icon-breadboard { background: #f0f0f0; border: 1px solid #ccc; }
.wiring-icon-led { background: radial-gradient(circle at 50% 35%, #ffe066, #e3b341); border-radius: 50%; width: 20px; height: 20px; }
.wiring-icon-resistor { background: linear-gradient(90deg, #d4a574 0%, #c9a227 20%, #d4a574 40%, #c9a227 60%, #d4a574 80%); height: 10px; margin-top: 5px; }
.wiring-icon-button { border-radius: 50%; background: #484f58; }
.wiring-icon-sensor { background: #1f6feb; }
.wiring-icon-motor { background: #238636; border-radius: 50%; }

.wiring-palette-hint {
  margin: -4px 0 8px;
}

.wiring-palette-item:hover {
  border-color: #388bfd;
}

.wiring-canvas {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, #30363d 1px, transparent 1px) var(--wiring-grid-x, 0px) var(--wiring-grid-y, 0px) / var(--wiring-grid-size, 20px) var(--wiring-grid-size, 20px),
    #0d1117;
  overflow: hidden;
  outline: none;
  cursor: crosshair;
}

.wiring-canvas.wiring-drag-over {
  box-shadow: inset 0 0 0 2px #388bfd;
}

.wiring-drop-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 32px;
  border: 2px dashed #484f58;
  border-radius: 12px;
  background: #161b22cc;
  color: #8b949e;
  text-align: center;
  max-width: 360px;
  pointer-events: none;
}

.wiring-drop-hint.hidden {
  display: none;
}

.wiring-drop-hint strong {
  color: #e6edf3;
  font-size: 1rem;
}

.wiring-parts-layer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
}

.wiring-parts-layer .wiring-part {
  pointer-events: auto;
}

.wiring-wires {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
  will-change: transform;
}

.wiring-wires .wiring-wire-path,
.wiring-wires .wiring-wire-handle,
.wiring-wires .wiring-wire-label,
.wiring-wires .wiring-wire-label-bg {
  pointer-events: all;
}

.wiring-pins-layer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  pointer-events: none;
  will-change: transform;
}

.wiring-pins-layer .wiring-pin {
  pointer-events: auto;
}

.wiring-wire-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.wiring-wire-handle {
  fill: #0d1117;
  stroke: #58a6ff;
  stroke-width: 2;
  cursor: grab;
  pointer-events: all;
}

.wiring-wire-handle:active {
  cursor: grabbing;
}

.wiring-wire-label {
  fill: #e6edf3;
  font-size: 12px;
  font-weight: 750;
  text-anchor: middle;
  pointer-events: all;
  cursor: text;
  user-select: none;
  paint-order: stroke;
  stroke: #0d1117;
  stroke-width: 4px;
}

.wiring-wire-label-bg {
  fill: rgba(13, 17, 23, 0.88);
  stroke: rgba(139, 148, 158, 0.75);
  stroke-width: 1;
  pointer-events: all;
  cursor: text;
}

.wiring-connector-outer,
.wiring-connector-inner {
  pointer-events: none;
}

.wiring-wire-editor {
  position: absolute;
  z-index: 30;
  width: min(320px, calc(100% - 24px));
  padding: 12px;
  border: 1px solid rgba(88, 166, 255, 0.55);
  border-radius: 14px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  color: var(--text);
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.wiring-wire-editor.hidden {
  display: none;
}

.wire-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.wire-editor-head strong,
.wire-editor-head span {
  display: block;
}

.wire-editor-head strong {
  font-size: 0.95rem;
}

.wire-editor-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.wire-editor-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.wire-editor-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.wire-editor-field span,
.wire-editor-connections span,
.wire-editor-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.wire-editor-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #0d1117;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
}

.wire-editor-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.18);
}

.wire-editor-connections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.wire-editor-connections > div {
  min-width: 0;
  border: 1px solid rgba(48, 54, 61, 0.8);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
}

.wire-editor-connections strong,
.wire-editor-connections em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wire-editor-connections strong {
  margin: 3px 0;
  font-size: 0.8rem;
}

.wire-editor-connections em {
  color: #c9d1d9;
  font-size: 0.74rem;
  font-style: normal;
}

.wire-editor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.wire-editor-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.wire-editor-meta i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.wire-color-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wire-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s, border-color 0.1s;
}

.wire-color-swatch:hover {
  transform: scale(1.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.wire-color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
  transform: scale(1.15);
}

.wire-color-custom {
  width: 28px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

.wire-color-custom::-webkit-color-swatch-wrapper { padding: 0; }
.wire-color-custom::-webkit-color-swatch { border-radius: 4px; border: none; }

.wire-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.wiring-drop-hint-sub {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: #8b949e;
}

.wiring-part {
  position: absolute;
  border: 2px solid #484f58;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  cursor: grab;
  user-select: none;
  z-index: 2;
}

.wiring-part.selected {
  border-color: #58a6ff;
  box-shadow:
    0 0 0 2px rgba(88, 166, 255, 0.5),
    0 0 18px rgba(88, 166, 255, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.35);
}

.wiring-part-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 750;
  color: #ffffff;
  text-align: center;
  padding: 4px 6px;
  pointer-events: none;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 4px rgba(0, 0, 0, 0.7);
}

.wiring-pin {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f85149;
  cursor: crosshair;
  z-index: 3;
  padding: 0;
}

.wiring-pin--labeled::after {
  content: attr(data-pin-label);
  position: absolute;
  z-index: 4;
  padding: 2px 5px;
  border: 1px solid rgba(88, 166, 255, 0.65);
  border-radius: 6px;
  background: rgba(13, 17, 23, 0.92);
  color: #f0f6fc;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35);
  opacity: 1;
}

.wiring-pin--label-left::after {
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
}

.wiring-pin--label-right::after {
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
}

.wiring-pin--label-top::after {
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
}

.wiring-pin--label-bottom::after {
  left: 50%;
  top: 15px;
  transform: translateX(-50%);
}

.wiring-pin--label-inside {
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  z-index: 8;
}

.wiring-pin--label-inside::after {
  inset: 50% auto auto 50%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-size: 8px;
  line-height: 1;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

.wiring-pin:hover,
.wiring-pin-hover {
  transform: scale(1.2);
  background: #58a6ff;
  box-shadow: 0 0 6px #58a6ff;
}

.wiring-pin--labeled:hover::after,
.wiring-pin--labeled.wiring-pin-hover::after,
.wiring-pin--labeled.wiring-pin-active::after {
  opacity: 1;
  border-color: rgba(88, 166, 255, 0.85);
}

.wiring-pin-hole {
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  background: #c9d1d9;
  border-color: #57606a;
  opacity: 0.35;
}

.wiring-pin-hole:hover,
.wiring-pin-hole.wiring-pin-active {
  opacity: 1;
  background: #58a6ff;
  border-color: #fff;
  transform: scale(1.4);
}

.wiring-pin-active {
  background: #58a6ff !important;
  box-shadow: 0 0 8px #58a6ff;
}

.wiring-pin-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(88, 166, 255, 0.7);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.96);
  color: #f0f6fc;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: normal;
  pointer-events: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(10px);
}

.wiring-pin-tooltip.hidden {
  display: none;
}

.wiring-selection-box {
  position: absolute;
  z-index: 10;
  border: 1px solid #58a6ff;
  background: rgba(88, 166, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.2);
  pointer-events: none;
}

.wiring-pin-rail.wiring-pin-power { background: #f85149; }
.wiring-pin-rail.wiring-pin-ground { background: #6e7681; }

.wiring-wires .wiring-wire-path {
  pointer-events: stroke;
  cursor: pointer;
}

.wiring-wires .wiring-wire-path.selected {
  filter: drop-shadow(0 0 4px currentColor);
}

.wdbg-focus-wire-flow {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 10 8;
  pointer-events: none;
  animation: wdbg-focus-wire-flow 0.65s linear infinite;
}

@keyframes wdbg-focus-wire-flow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -36; }
}

.wdbg-focus-wire-label--issue {
  fill: #ff7b72;
  font-weight: 700;
}

.wdbg-focus-label-bg:has(+ .wdbg-focus-wire-label--issue) {
  stroke: rgba(248, 81, 73, 0.55);
}

.wdbg-focus-legend-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.wdbg-focus-legend-heading--issue {
  color: #ff7b72;
}

.wdbg-focus-wire-legend--issue li {
  color: #ffccc7;
}

.wdbg-focus-wire-swatch--issue {
  background: linear-gradient(90deg, #f85149 40%, transparent 40%, transparent 60%, #f85149 60%);
  background-size: 12px 100%;
  animation: wdbg-focus-wire-flow 0.65s linear infinite;
  height: 5px;
  width: 18px;
}

.wiring-wire-focus-flow--issue {
  stroke-width: 4.5;
  opacity: 0.98;
}

.wiring-wire-path--focus {
  stroke-width: 4.5;
  filter: drop-shadow(0 0 8px rgba(248, 81, 73, 0.85));
}

.wiring-wire-focus-flow {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 10 8;
  pointer-events: none;
  opacity: 0.95;
  animation: wiring-focus-flow 0.7s linear infinite;
}

@keyframes wiring-focus-flow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -36; }
}

.wiring-wire-preview {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
  will-change: transform;
}

.wiring-wire-preview-path {
  fill: none;
  stroke-width: 3;
  stroke-dasharray: 6 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(88, 166, 255, 0.7));
}

.wiring-part--breadboard {
  background: #f0f0f0 !important;
  border-color: #ccc !important;
}

.wiring-part--breadboard .wiring-part-label {
  color: #111827;
  font-size: 0.68rem;
  align-items: flex-start;
  padding-top: 6px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

.wiring-part--arduino-uno,
.wiring-part--arduino-mega {
  background: #00979d !important;
  border-color: #006d72 !important;
}

.wiring-part--arduino-uno .wiring-part-label,
.wiring-part--arduino-mega .wiring-part-label {
  color: #fff;
}

.wiring-vis-arduino {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
}

.wiring-vis-arduino-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.55rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.05em;
}

/* Pseudo-3D microcontroller board with real header strips */
.wiring-vis-board {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  overflow: hidden;
}
.wiring-board-pcb {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 14%;
  bottom: 14%;
  border-radius: 4px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.28)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 6px, transparent 6px 12px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    0 2px 3px rgba(0, 0, 0, 0.35);
}
.wiring-board-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34%;
  height: 42%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: linear-gradient(160deg, #2b2f36, #0b0d10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 2px rgba(0,0,0,0.5);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
}
.wiring-board-leds {
  position: absolute;
  top: 16%;
  left: 14%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 8px 0 0 #e3b341, 0 0 4px rgba(63, 185, 80, 0.8);
}
.wiring-board-usb {
  position: absolute;
  left: -3px;
  top: 50%;
  width: 12px;
  height: 30%;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, #d8dde3, #9aa2ab);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0,0,0,0.4);
}
.wiring-board-header {
  position: absolute;
  left: 0;
  right: 0;
  height: 14%;
  background: linear-gradient(180deg, #15181c, #05070a);
}
.wiring-board-header--top { top: 0; border-radius: 7px 7px 0 0; }
.wiring-board-header--bottom { bottom: 0; border-radius: 0 0 7px 7px; }
.wiring-board-pad {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #c79a3a 70%, #8a6a1f);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), inset 0 0 2px rgba(0,0,0,0.5);
}

.wiring-vis-breadboard {
  position: absolute;
  inset: 4px;
}

.wiring-bb-rail {
  position: absolute;
  left: 4%;
  right: 4%;
  height: 6%;
  border-radius: 2px;
}

.wiring-bb-rail-plus { top: 2%; background: rgba(248,81,73,0.35); }
.wiring-bb-rail-minus { bottom: 2%; background: rgba(110,118,129,0.35); }

.wiring-bb-divider {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 48%;
  height: 2px;
  background: #ccc;
}

.wiring-bb-holes {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 22%;
  bottom: 10%;
  opacity: 0.55;
  pointer-events: none;
  background-image: radial-gradient(circle, #8b949e 2px, transparent 2.5px);
  background-size: 6.29% 7.69%;
  background-position: 0 0;
}

.wiring-bb-hole {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: #8b949e;
  opacity: 0.55;
  pointer-events: none;
}

.wiring-vis-transistor {
  display: flex;
  align-items: center;
  justify-content: center;
}

.wiring-vis-transistor-body {
  width: 70%;
  height: 55%;
  border: 2px solid #8b949e;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, #30363d, #21262d);
}

.wiring-vis-diode {
  position: absolute;
  top: 15%;
  left: 0;
  right: 0;
  height: 70%;
  background: #484f58;
  border: 1px solid #8b949e;
  border-radius: 2px;
  clip-path: polygon(8% 50%, 42% 10%, 42% 90%);
}

.wiring-part--transistor .wiring-part-label,
.wiring-part--diode .wiring-part-label {
  color: #e6edf3;
  font-size: 0.58rem;
  align-items: flex-end;
  padding-bottom: 2px;
}

.wiring-part--motor .wiring-part-label {
  color: #fff;
}

.wiring-part--led {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.wiring-vis-led-dome {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 40% 30%, #fff9c4, #e3b341 55%, #b08800);
  border: 2px solid #8b949e;
  box-shadow: 0 0 12px rgba(227,179,65,0.5);
}

.wiring-part--led .wiring-part-label {
  position: absolute;
  bottom: -16px;
  top: auto;
  height: auto;
  color: var(--muted);
  font-size: 0.62rem;
}

.wiring-part--resistor {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.wiring-vis-resistor {
  position: absolute;
  top: 20%;
  left: 0;
  right: 0;
  height: 60%;
  background: repeating-linear-gradient(
    90deg,
    #d4a574 0px, #d4a574 6px,
    #c9a227 6px, #c9a227 8px,
    #d4a574 8px, #d4a574 14px
  );
  border-radius: 3px;
  border: 1px solid #8b6914;
}

.wiring-part-visual {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ── 3D-style actuator visuals + simulation animation ──────────────────── */
.wiring-part--motor,
.wiring-part--stepper {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.wiring-part--motor .wiring-part-label,
.wiring-part--stepper .wiring-part-label,
.wiring-part--servo-motor .wiring-part-label {
  position: absolute;
  bottom: -16px;
  top: auto;
  height: auto;
  color: var(--muted);
  font-size: 0.6rem;
  z-index: 2;
}

.wiring-vis-motor,
.wiring-vis-stepper {
  display: grid;
  place-items: center;
  perspective: 200px;
}

.wiring-motor-can,
.wiring-stepper-can {
  position: absolute;
  inset: 12% 14%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, #f0f6fc 0%, #9aa4ad 30%, #5b636b 70%, #2b3036 100%);
  border: 2px solid #1c2128;
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.45);
  transform: rotateX(38deg);
}

.wiring-stepper-can {
  background:
    radial-gradient(circle at 38% 30%, #cfe3ff 0%, #6ea8ff 32%, #1f6feb 72%, #103a82 100%);
}

.wiring-rotor {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  transform-origin: center;
  z-index: 1;
  will-change: transform;
}

.wiring-rotor-flap {
  position: absolute;
  top: -3px;
  left: -28%;
  width: 56%;
  min-width: 26px;
  height: 6px;
  margin-left: -13px;
  border-radius: 3px;
  background: linear-gradient(90deg, #ffd166, #f4a259);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.wiring-rotor--stepper .wiring-rotor-mark {
  position: absolute;
  top: -16px;
  left: -2px;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: #ffd166;
  box-shadow: 0 0 4px rgba(255, 209, 102, 0.8);
}

.wiring-motor-hub,
.wiring-servo-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #21262d;
  border: 1px solid #6e7681;
  z-index: 2;
}

.wiring-part--active .wiring-motor-can,
.wiring-part--active .wiring-stepper-can {
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.5), 0 0 14px rgba(88, 166, 255, 0.6);
}

/* Servo */
.wiring-part--servo-motor {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.wiring-vis-servo {
  display: block;
}

.wiring-servo-body {
  position: absolute;
  inset: 28% 18% 12% 18%;
  border-radius: 4px;
  background: linear-gradient(180deg, #2f6f3f, #1d4d2b);
  border: 1px solid #14361e;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.15);
}

.wiring-servo-horn {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 6px;
  height: 30px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f0f6fc, #aab2bb);
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(-90deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  z-index: 2;
  will-change: transform;
}

/* LED glow when lit */
.wiring-vis-led-dome.lit {
  box-shadow: 0 0 18px 4px rgba(255, 220, 90, 0.9);
  background: radial-gradient(circle at 40% 30%, #fffde7, #ffe14d 50%, #f4b400);
}

.wiring-simulating .wiring-part {
  transition: none;
}

/* ── Code & Simulate modal ─────────────────────────────────────────────── */
.wiring-code-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 9, 0.62);
  backdrop-filter: blur(2px);
}

.wiring-code-overlay.hidden {
  display: none;
}

.wiring-code-modal {
  width: min(1080px, 94vw);
  height: min(720px, 90vh);
  display: flex;
  flex-direction: column;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.wiring-code-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid #21262d;
  background: #161b22;
}

.wiring-code-head > strong {
  font-size: 0.95rem;
}

.wiring-code-langs {
  display: flex;
  gap: 4px;
  margin-left: 6px;
}

.wiring-code-lang {
  border: 1px solid #30363d;
  background: #0d1117;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.wiring-code-lang.active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.wiring-code-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.wiring-code-close:hover {
  color: #f0f6fc;
}

.wiring-code-body {
  flex: 1;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 290px;
  min-height: 0;
}

.wiring-code-explorer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border-right: 1px solid #21262d;
  background: #0d1117;
}

.wiring-code-explorer h4 {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wiring-code-file {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #c9d1d9;
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
}

.wiring-code-file.active,
.wiring-code-file:hover {
  background: rgba(88, 166, 255, 0.12);
  border-color: rgba(88, 166, 255, 0.35);
}

.wiring-code-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b949e;
}

.file-dot--code { background: #3fb950; }
.file-dot--json { background: #d29922; }
.file-dot--doc { background: #a371f7; }

.wiring-code-editor-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid #21262d;
}

.wiring-code-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #21262d;
  flex-wrap: wrap;
}

.wiring-code-toolbar .btn {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.wiring-code-btnpress {
  font-size: 0.74rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.wiring-code-editor-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: #0d1117;
}

.wiring-code-gutter {
  overflow: hidden;
  padding: 12px 8px 12px 0;
  border-right: 1px solid #21262d;
  background: #090d13;
  color: #6e7681;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: right;
  user-select: none;
}

.wiring-code-gutter span {
  display: block;
  height: 1.5em;
}

.wiring-code-gutter span.active {
  color: #58a6ff;
  font-weight: 800;
}

.wiring-code-editor-stack {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.wiring-code-highlight,
.wiring-code-text {
  position: absolute;
  inset: 0;
  margin: 0;
  border: none;
  outline: none;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
}

.wiring-code-highlight {
  pointer-events: none;
  color: #c9d1d9;
  overflow: hidden;
}

.wiring-code-text {
  z-index: 1;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: #f0f6fc;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.wiring-code-text::selection {
  background: rgba(88, 166, 255, 0.35);
}

.wiring-code-text.is-readonly {
  cursor: default;
}

.tok-comment { color: #8b949e; }
.tok-string { color: #a5d6ff; }
.tok-keyword,
.tok-key { color: #ff7b72; }
.tok-number { color: #79c0ff; }
.tok-bool { color: #d2a8ff; }

.wiring-code-statusline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 10px;
  border-top: 1px solid #21262d;
  background: #090d13;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.68rem;
}

.wiring-code-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wiring-code-side h4 {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid #21262d;
}

.wiring-code-validate {
  flex: 0 0 auto;
  max-height: 45%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wiring-code-validate-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wiring-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.76rem;
  color: #c9d1d9;
}

.wiring-check-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: #6e7681;
}

.wiring-check.ok .wiring-check-dot {
  background: #3fb950;
  box-shadow: 0 0 6px rgba(63, 185, 80, 0.7);
}

.wiring-check.warn .wiring-check-dot {
  background: #d29922;
}

.wiring-code-console-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid #21262d;
}

.wiring-code-console {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.5;
  color: #8b949e;
}

.wiring-code-log--error {
  color: #ff7b72;
}

.wiring-code-log--warn {
  color: #d29922;
}

.wiring-code-log--info {
  color: #58a6ff;
}

@media (max-width: 760px) {
  .wiring-code-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1.4fr 1fr;
  }
  .wiring-code-explorer {
    border-right: none;
    border-bottom: 1px solid #21262d;
  }
  .wiring-code-editor-col {
    border-right: none;
    border-bottom: 1px solid #21262d;
  }
}

@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  body {
    overscroll-behavior: none;
  }

  #app {
    grid-template-columns: 1fr !important;
    grid-template-rows: 44px 1fr !important;
    grid-template-areas:
      "header"
      "main-col" !important;
  }

  #workspace-mode-bar,
  #ribbon-container,
  .sidebar.left,
  .sidebar.right,
  .panel-gutter-v,
  #timeline-panel,
  .timeline-expand-tab,
  .toolbar-pick,
  #btn-toggle-ribbon,
  #btn-toggle-sidebar,
  .toolbar-actions #btn-new-project,
  .toolbar-actions .unit-select {
    display: none !important;
  }

  /* Keep main nav reachable via the Menu dropdown instead of hiding it. */
  .toolbar-nav {
    display: flex !important;
  }
  .toolbar-nav:not(.is-compact) {
    /* Force compact styling if JS hasn't marked it yet */
  }
  .toolbar-nav .toolbar-nav-toggle {
    display: inline-flex;
  }
  .toolbar-nav .toolbar-nav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    padding: 6px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(13, 17, 23, 0.98);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
  .toolbar-nav.is-open .toolbar-nav-menu {
    display: flex;
  }
  .toolbar-nav .nav-tab {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
  }

  .toolbar {
    min-width: 0;
    height: 44px;
    padding: 0 10px;
    gap: 8px;
  }

  .brand h1 {
    font-size: 0.92rem;
  }

  .brand .logo {
    width: 84px;
    height: 40px;
  }

  .toolbar-actions {
    margin-left: auto;
    gap: 6px;
  }

  .toolbar-actions label.btn {
    padding: 6px 9px;
    font-size: 0.72rem;
  }

  .main-column,
  #viewport {
    min-height: 0;
    height: 100%;
  }

  #viewport {
    background: #0d1117;
    touch-action: none;
  }

  .viewport-view-bar,
  .viewport-lighting-tab {
    display: none;
  }

  .mobile-showcase-bar {
    display: flex;
  }

  .mobile-corner-launchers {
    display: block;
  }

  .mobile-corner-sheet:not(.hidden) {
    display: block;
  }

  body.mobile-left-panel-open .sidebar.left {
    display: flex !important;
    position: fixed;
    z-index: 70;
    inset: 0;
    width: 100vw;
    max-width: none;
    padding-top: calc(58px + env(safe-area-inset-top));
    border: 0;
    border-radius: 0;
    background: rgba(13, 17, 23, 0.98);
    box-shadow: none;
    overflow: auto;
  }

  body.mobile-right-panel-open .sidebar.right {
    display: flex !important;
    position: fixed;
    z-index: 70;
    inset: 0;
    width: 100vw;
    max-width: none;
    padding-top: calc(58px + env(safe-area-inset-top));
    border: 0;
    border-radius: 0;
    background: rgba(13, 17, 23, 0.98);
    box-shadow: none;
    overflow: auto;
  }

  body.mobile-left-panel-open .mobile-corner-launchers,
  body.mobile-right-panel-open .mobile-corner-launchers {
    display: none;
  }

  body.mobile-left-panel-open .mobile-panel-close,
  body.mobile-right-panel-open .mobile-panel-close {
    display: block;
  }

  body.mobile-left-panel-open .sidebar.left,
  body.mobile-right-panel-open .sidebar.right {
    font-size: 17px;
  }

  body.mobile-left-panel-open .sidebar.left h2,
  body.mobile-right-panel-open .sidebar.right h2 {
    font-size: 1.2rem;
    letter-spacing: 0.02em;
  }

  body.mobile-left-panel-open .sidebar.left h3,
  body.mobile-right-panel-open .sidebar.right h3 {
    font-size: 1.05rem;
  }

  body.mobile-left-panel-open .sidebar.left .muted.small,
  body.mobile-right-panel-open .sidebar.right .muted.small,
  body.mobile-left-panel-open .sidebar.left small,
  body.mobile-right-panel-open .sidebar.right small {
    font-size: 0.95rem;
    line-height: 1.35;
  }

  body.mobile-left-panel-open .sidebar.left input,
  body.mobile-left-panel-open .sidebar.left select,
  body.mobile-right-panel-open .sidebar.right input,
  body.mobile-right-panel-open .sidebar.right select,
  body.mobile-right-panel-open .sidebar.right textarea {
    min-height: 44px;
    font-size: 1rem;
  }

  body.mobile-left-panel-open .sidebar.left .btn,
  body.mobile-left-panel-open .sidebar.left button,
  body.mobile-right-panel-open .sidebar.right .btn,
  body.mobile-right-panel-open .sidebar.right button {
    min-height: 42px;
    font-size: 0.98rem;
  }

  body.mobile-left-panel-open .project-browser,
  body.mobile-left-panel-open .design-browser-root,
  body.mobile-left-panel-open .workspace-activity-list {
    font-size: 1rem;
  }

  body.mobile-left-panel-open .proj-item,
  body.mobile-left-panel-open .browser-row,
  body.mobile-left-panel-open .onshape-doc-item,
  body.mobile-left-panel-open .workspace-activity-item {
    min-height: 52px;
    padding: 12px 10px;
  }

  body.mobile-right-panel-open .right-panel-tabs {
    gap: 8px;
    padding: 8px;
  }

  body.mobile-right-panel-open .right-panel-tab {
    min-height: 44px;
    font-size: 0.95rem;
  }

  body.mobile-right-panel-open .prompt-panel textarea,
  body.mobile-right-panel-open .wiring-prompt-panel textarea,
  body.mobile-right-panel-open .rigging-prompt-panel textarea {
    min-height: 140px;
    font-size: 1.05rem;
    line-height: 1.45;
  }

  .mobile-model-picker:not(.hidden) {
    display: block;
  }

  /* Clear the 4 corner launchers — no overlap with cube / tools / spinner */
  .mobile-corner-btn {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    font-size: 0.88rem;
    font-weight: 800;
    border-color: rgba(139, 148, 158, 0.42);
    background: rgba(13, 17, 23, 0.78);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    letter-spacing: 0.01em;
  }

  .mobile-corner-btn--tl {
    top: max(10px, env(safe-area-inset-top, 0px));
    left: max(10px, env(safe-area-inset-left, 0px));
  }

  .mobile-corner-btn--tr {
    top: max(10px, env(safe-area-inset-top, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
  }

  .mobile-corner-btn--br {
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .mobile-corner-btn--bl {
    left: max(10px, env(safe-area-inset-left, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .view-cube {
    top: calc(max(10px, env(safe-area-inset-top, 0px)) + 46px + 10px);
    right: max(8px, env(safe-area-inset-right, 0px));
    width: 92px;
    height: 104px;
    transform: scale(0.78);
    transform-origin: top right;
    z-index: 18;
  }

  .viewport-corner-tools {
    top: calc(max(10px, env(safe-area-inset-top, 0px)) + 46px + 10px + 108px);
    right: max(8px, env(safe-area-inset-right, 0px));
    z-index: 18;
  }

  .viewport-corner-btn {
    padding: 5px 8px;
    font-size: 0.68rem;
    border-radius: 8px;
    background: rgba(13, 17, 23, 0.78);
  }

  .viewport-spinner {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 46px + 10px);
    width: auto;
    max-width: none;
  }

  .viewport-status-toast-stack {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 46px + 10px);
    width: auto;
    align-items: stretch;
  }

  .viewport-status-toast-stack.is-generating {
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 46px + 112px);
  }

  .viewport-status-toast {
    border-radius: 14px;
  }

  .viewport-generation-user {
    left: max(10px, env(safe-area-inset-left, 0px));
    top: calc(max(10px, env(safe-area-inset-top, 0px)) + 46px + 10px);
    max-width: calc(100% - 130px);
    padding: 6px 9px;
    border-radius: 14px;
  }

  .viewport-error-banner {
    left: max(10px, env(safe-area-inset-left, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
    width: auto;
    max-width: none;
    transform: none;
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 46px + 10px);
  }

  #viewport {
    overflow: hidden;
  }

  #viewport canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
  }
}

.wiring-load-example-inline {
  pointer-events: auto;
}

.wiring-drop-hint .btn {
  pointer-events: auto;
}

#ribbon-container {
  grid-area: ribbon;
  min-height: 0;
  overflow: visible;
}

.main-column {
  grid-area: main-col;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.dxf-tab-bar {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 34px;
  padding: 4px 8px 0;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.96);
  overflow-x: auto;
  flex-shrink: 0;
}

.dxf-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: rgba(48, 54, 61, 0.45);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.dxf-tab.active {
  color: var(--text);
  background: rgba(22, 27, 34, 0.98);
  border-color: var(--border);
}

.dxf-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dxf-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.dxf-tab-close:hover {
  background: rgba(248, 81, 73, 0.18);
  color: #ff7b72;
}

.dxf-viewer {
  position: absolute;
  inset: 0;
  z-index: 46;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0d1117;
  border-top: 1px solid var(--border);
}

.main-column.doc-tabs-open .dxf-viewer {
  top: 34px;
}

/* Document / photoreal render viewer covers the main column — keep timeline chrome
   from painting a grey split line across the image (resize handle is z-index 40). */
.main-column.doc-tabs-open #timeline-resize-handle,
.main-column.doc-tabs-open #timeline-panel,
.main-column.doc-tabs-open .timeline-expand-tab,
.main-column.doc-tabs-open .timeline-panel.timeline-panel--collapsed {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}

#viewport.doc-viewer-active,
#viewport.dxf-viewer-active,
#viewport.ref-viewer-active {
  visibility: hidden;
}

.doc-tab-kind {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  opacity: 0.85;
}

.dxf-tab-bar.hidden + #viewport + .dxf-viewer,
.dxf-tab-bar.hidden ~ .dxf-viewer {
  /* kept for legacy; doc-tabs-open controls inset now */
}

.ref-viewer-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.ref-viewer-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0d1117;
}

.ref-notes-panel {
  width: min(280px, 34vw);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-left: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.98);
}

.ref-notes-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ref-notes-editor {
  flex: 1;
  min-height: 120px;
  resize: none;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.95);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
}

.ref-notes-hint {
  margin: 0;
}

.ref-text-editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: none;
  resize: none;
  padding: 16px 18px;
  background: #0d1117;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.ref-viewer-empty {
  display: grid;
  place-items: center;
  flex: 1;
  color: var(--text-muted);
  padding: 24px;
}

.ref-viewer-stage-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(88, 166, 255, 0.06), transparent 40%),
    #0d1117;
}

.ref-viewer-stage {
  transform-origin: center center;
  will-change: transform;
}

.ref-image-stack {
  position: relative;
  display: inline-block;
  max-width: min(92vw, 1100px);
  user-select: none;
  touch-action: none;
}

.ref-image {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: calc(100vh - 180px);
  height: auto;
  pointer-events: none;
}

.ref-markup-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ref-pdf-frame {
  flex: 1;
  min-height: 0;
}

.ref-pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #161b22;
}

.ref-pdf-markup-wrap {
  overflow: auto;
}

.ref-pdf-pages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  align-items: center;
}

.ref-pdf-page {
  position: relative;
  display: inline-block;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  background: #fff;
  cursor: default;
}

.ref-pdf-page canvas.ref-pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.ref-pdf-page .ref-markup-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#ref-viewer.ref-draw-mode .ref-pdf-page,
#ref-viewer.ref-draw-mode .ref-image-stack {
  cursor: crosshair;
}

#ref-viewer:not(.ref-draw-mode) .ref-pdf-page,
#ref-viewer:not(.ref-draw-mode) .ref-image-stack,
#ref-viewer:not(.ref-draw-mode) .ref-viewer-stage-wrap {
  cursor: grab;
}

#ref-viewer:not(.ref-draw-mode) .ref-pdf-page:active,
#ref-viewer:not(.ref-draw-mode) .ref-image-stack:active,
#ref-viewer:not(.ref-draw-mode) .ref-viewer-stage-wrap:active {
  cursor: grabbing;
}

.dxf-viewer-btn.accent {
  background: rgba(63, 185, 80, 0.18);
  border-color: rgba(63, 185, 80, 0.45);
  color: #3fb950;
}

.dxf-viewer-btn.accent:hover {
  background: rgba(63, 185, 80, 0.28);
}

.browser-action-send-ai {
  color: #3fb950;
}

.dxf-viewer-btn.active {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.55);
  background: rgba(88, 166, 255, 0.16);
}

.dxf-viewer-btn.primary {
  color: #fff;
  background: rgba(63, 128, 255, 0.9);
  border-color: transparent;
}

.dxf-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.98);
  min-width: 0;
  overflow: hidden;
}

.dxf-viewer-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dxf-viewer-title strong {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dxf-viewer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
}

.dxf-viewer-btn {
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(48, 54, 61, 0.55);
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}

.dxf-viewer-btn:hover {
  background: rgba(56, 139, 253, 0.16);
  border-color: rgba(56, 139, 253, 0.35);
}

.ref-download-menu {
  position: relative;
  display: inline-flex;
}

.ref-markup-toolbar {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.ref-viewer-toolbar .dxf-viewer-title {
  flex: 0 1 220px;
}

.ref-viewer-toolbar .dxf-viewer-actions {
  flex-shrink: 1;
}

.ref-tool-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.ref-image-context-menu {
  position: fixed;
  z-index: 12000;
  display: grid;
  min-width: 240px;
  padding: 6px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.52);
}

.ref-image-context-menu-title {
  display: none;
}

.ref-image-context-menu button {
  appearance: none;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.ref-image-context-menu button:hover {
  background: rgba(56, 139, 253, 0.16);
}

@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  .ref-image-context-menu {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    top: auto !important;
    bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
    min-width: 0;
    width: auto;
    max-height: min(52vh, 420px);
    overflow: auto;
    padding: 10px;
    gap: 8px;
    border-radius: 20px;
    border-color: rgba(88, 166, 255, 0.4);
    background: rgba(13, 17, 23, 0.98);
    box-shadow: 0 -18px 54px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .ref-image-context-menu-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 8px;
    color: var(--text);
  }

  .ref-image-context-menu-title strong {
    font-size: 1rem;
    letter-spacing: -0.01em;
  }

  .ref-image-context-menu-title button {
    width: 38px;
    min-height: 38px;
    padding: 0;
    border: 1px solid rgba(139, 148, 158, 0.34);
    border-radius: 13px;
    background: rgba(22, 27, 34, 0.86);
    text-align: center;
    font-size: 1.4rem;
    line-height: 1;
  }

  .ref-image-context-menu > button {
    min-height: 48px;
    padding: 13px 14px;
    border: 1px solid rgba(139, 148, 158, 0.22);
    border-radius: 14px;
    background: rgba(22, 27, 34, 0.72);
    font-size: 0.96rem;
    font-weight: 760;
  }
}

.workspace-realtime-team-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.workspace-realtime-team-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(139, 148, 158, 0.24);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.72);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.workspace-realtime-team-option:hover {
  border-color: rgba(88, 166, 255, 0.48);
  background: rgba(56, 139, 253, 0.14);
}

.workspace-realtime-team-option span {
  font-weight: 750;
}

.workspace-realtime-team-option small {
  color: var(--muted);
  white-space: nowrap;
}

.workspace-realtime-workspace-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.workspace-realtime-workspace-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 14px;
  background: rgba(13, 17, 23, 0.68);
}

.workspace-realtime-workspace-card.is-connected {
  border-color: rgba(63, 185, 80, 0.34);
  background:
    radial-gradient(circle at 100% 0%, rgba(63, 185, 80, 0.12), transparent 32%),
    rgba(13, 17, 23, 0.74);
}

.workspace-realtime-workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workspace-realtime-workspace-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.workspace-realtime-workspace-head small {
  color: var(--muted);
}

.workspace-realtime-project-tree-list {
  display: grid;
  gap: 10px;
}

.workspace-realtime-tree-project {
  padding: 10px;
}

.workspace-realtime-tree-project-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.workspace-realtime-tree-project-summary span {
  font-weight: 750;
}

.workspace-realtime-tree-project-summary small {
  color: var(--muted);
}

.workspace-realtime-file-tree {
  margin-top: 10px;
}

.ref-tool-group--style {
  gap: 8px;
  padding: 4px 8px;
}

.ref-color-picker,
.ref-width-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--muted);
}

.ref-color-picker input[type="color"] {
  width: 28px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
}

.ref-width-picker input[type="range"] {
  width: 72px;
}

.ref-swatch-row {
  display: inline-flex;
  gap: 4px;
}

.ref-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
}

.ref-swatch.is-active {
  outline: 2px solid #58a6ff;
  outline-offset: 1px;
}

.ref-region-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.ref-region-overlay.hidden {
  display: none;
}

.ref-region-box {
  position: absolute;
  border: 2px dashed #a371f7;
  background: rgba(163, 113, 247, 0.16);
  box-shadow: 0 0 0 1px rgba(13, 17, 23, 0.35);
}

.ref-viewer-main {
  position: relative;
}

.ref-region-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(6px);
}

.ref-region-edit-card {
  position: relative;
  width: min(440px, 100%);
  display: grid;
  gap: 10px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(163, 113, 247, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.96));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.ref-region-edit-card h3 {
  margin: 0;
  font-size: 1rem;
}

.ref-region-edit-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.ref-region-edit-preview {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d1117;
  max-height: 220px;
  display: grid;
  place-items: center;
}

.ref-region-edit-preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.ref-tool-group--save-mode {
  gap: 4px;
}

.ref-tool-group-label {
  padding: 0 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ref-tool-group--save-mode .dxf-viewer-btn.active {
  border-color: rgba(163, 113, 247, 0.65);
  background: rgba(163, 113, 247, 0.18);
  color: #e6d5ff;
}

.ref-region-field {
  display: grid;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.ref-region-field > span {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ref-region-field select,
.ref-region-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
}

.ref-save-mode-toggle {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ref-save-mode-toggle .dxf-viewer-btn.active {
  border-color: rgba(163, 113, 247, 0.65);
  background: rgba(163, 113, 247, 0.18);
  color: #e6d5ff;
}

.ref-region-edit-card textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 78px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  resize: vertical;
}

.ref-region-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.ref-dont-ask {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.78rem;
  color: var(--muted);
}

.ref-region-edit-status {
  min-height: 1.2em;
  margin: 0;
}

.ref-download-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 160px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #161b22;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ref-download-menu-panel.hidden {
  display: none;
}

.ref-download-menu-panel button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
}

.ref-download-menu-panel button:hover {
  background: rgba(56, 139, 253, 0.16);
}

.dxf-viewer-canvas-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    #0d1117;
  background-size: 24px 24px;
  cursor: grab;
}

.dxf-viewer-canvas-wrap.is-panning {
  cursor: grabbing;
}

.dxf-viewer-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.05s linear;
}

.dxf-svg {
  width: min(100%, 1200px);
  height: min(100%, 900px);
  max-width: calc(100% - 48px);
  max-height: calc(100% - 48px);
}

.dxf-svg-bg {
  fill: rgba(13, 17, 23, 0.92);
}

.dxf-viewer-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 24px;
  text-align: center;
}

.browser-item--drawing .browser-vis-btn {
  visibility: hidden;
  pointer-events: none;
}

.toolbar {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  overflow: visible;
}

.toolbar-pick {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  justify-content: flex-start;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  margin-right: auto;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0d1117;
  overflow: hidden;
}

.toolbar-pick-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 4px;
}

.toolbar-pick .pick-btn {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.toolbar-pick .left-drag-mode-btn {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-color: #484f58;
  background: #161b22;
  color: var(--muted);
  white-space: nowrap;
}

.toolbar-pick .left-drag-mode-btn.active {
  border-color: #3fb950;
  background: #3fb95022;
  color: #7ee787;
}

.toolbar-pick .left-drag-mode-btn {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-style: dashed;
  white-space: nowrap;
}

.toolbar-pick .left-drag-mode-btn.active {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.16);
  color: #c9e6ff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: 2px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.brand-link:hover h1 {
  color: var(--accent);
}

.toolbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-right: 4px;
  position: relative;
  z-index: 40;
}

.toolbar-nav-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #161b22;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.toolbar-nav-toggle:hover {
  background: #21262d;
  border-color: #484f58;
}

.toolbar-nav.is-compact .toolbar-nav-toggle {
  display: inline-flex;
}

.toolbar-nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
}

.toolbar-nav.is-compact .toolbar-nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  padding: 6px;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.toolbar-nav.is-compact.is-open .toolbar-nav-menu {
  display: flex;
}

.mobile-app-menu-grid {
  display: none;
}

.toolbar-nav.is-compact .mobile-app-menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(48, 54, 61, 0.78);
}

.mobile-app-menu-grid button {
  width: 100%;
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.mobile-app-menu-grid button:hover,
.mobile-app-menu-grid button:focus-visible {
  outline: none;
  background: #21262d;
  border-color: var(--border);
}

.mobile-app-menu-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Mid-width: shed lower-priority pick chrome before things collide. */
@media (max-width: 1280px) {
  .toolbar-pick .left-drag-mode-btn {
    display: none !important;
  }
}
@media (max-width: 1120px) {
  .toolbar-actions #btn-new-project {
    display: none !important;
  }
  .toolbar-pick-label {
    display: none;
  }
}

.toolbar-nav.is-compact .nav-tab {
  width: 100%;
  justify-content: flex-start;
  padding: 8px 12px;
}

/* Fallback: prefer Menu only on mobile/coarse layouts before JS measures. */
@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  .toolbar-nav .toolbar-nav-toggle {
    display: inline-flex;
  }
  .toolbar-nav .toolbar-nav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    padding: 6px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(13, 17, 23, 0.98);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
  }
  .toolbar-nav.is-open .toolbar-nav-menu {
    display: flex;
  }
  .toolbar-nav .nav-tab {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
  }
  .toolbar-nav .mobile-app-menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(48, 54, 61, 0.78);
  }
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
  background: #21262d;
}

.nav-tab.active {
  color: var(--text);
  background: #21262d;
  border-color: var(--border);
}

.brand h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.logo {
  width: 96px;
  height: 48px;
  object-fit: contain;
  object-position: center;
  display: block;
  flex-shrink: 0;
  border-radius: 8px;
  background: transparent;
}

.toolbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  overflow: visible;
}

.toolbar-actions > .btn,
.toolbar-actions > label.btn,
.toolbar-actions > .unit-select {
  box-sizing: border-box;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-block: 0;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  margin: 0;
  vertical-align: middle;
}

.toolbar-actions > .btn,
.toolbar-actions > label.btn {
  padding-inline: 14px;
}

.toolbar-actions > label.btn.primary {
  line-height: 1;
  text-align: center;
  user-select: none;
}

.toolbar-actions > label.btn.primary input[hidden] {
  display: none !important;
}

.unit-select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  min-width: 66px;
  padding: 0 30px 0 14px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.16), rgba(88, 166, 255, 0.04)),
    #0d1117;
  color: #dce8ff;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, color 0.15s;
}

.unit-select:hover {
  border-color: rgba(88, 166, 255, 0.55);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.24), rgba(88, 166, 255, 0.07)),
    #0d1117;
}

.unit-select:focus {
  border-color: #58a6ff;
  box-shadow:
    0 0 0 3px rgba(88, 166, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.toolbar-actions::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: -27px;
  margin-right: 11px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #8b949e;
  pointer-events: none;
}


.btn {
  border: 1px solid var(--border);
  background: #21262d;
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: #30363d; }
.btn.primary { border-color: #388bfd; background: #1f6feb33; }
.btn.primary:hover { background: #1f6feb55; }
.btn.accent { border-color: #238636; background: #23863633; }
.btn.accent:hover { background: #23863655; }
.btn.secondary.active { border-color: var(--accent); color: var(--accent); }
.btn.danger { border-color: #da3633; background: #da363322; color: #ff7b72; }
.btn.danger:hover { background: #da363344; }
.btn.full { width: 100%; margin-top: 8px; }

label.btn { display: inline-flex; align-items: center; }

.sidebar {
  background: var(--panel);
  border-color: var(--border);
}

.sidebar.left {
  grid-area: left;
  position: relative;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: contain;
}

.left-scroll {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  overscroll-behavior: contain;
  padding: 14px;
}

.left-log-dock {
  flex-shrink: 0;
  height: clamp(72px, var(--left-log-height), 24vh);
  min-height: 72px;
  max-height: 220px;
  border-top: 1px solid var(--border);
  background: #0d1117;
  overflow: hidden;
}

.sidebar.right {
  grid-area: right;
  position: relative;
  border-left: 1px solid var(--border);
  padding: 14px 14px 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overscroll-behavior: contain;
}

#viewport {
  flex: 1;
  position: relative;
  min-height: 0;
  overscroll-behavior: contain;
}

#viewport canvas {
  display: block;
  position: relative;
  z-index: 1;
}

.webgl-fallback-canvas.webgl-unavailable {
  width: 100%;
  height: 100%;
  opacity: 0;
}

.webgl-fallback-message {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100% - 48px));
  padding: 18px 20px;
  border: 1px solid rgba(248, 81, 73, 0.35);
  border-radius: 14px;
  background: rgba(13, 17, 23, 0.92);
  color: #f0f6fc;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  text-align: center;
  pointer-events: none;
}

.webgl-fallback-message strong {
  color: #ff7b72;
}

.webgl-fallback-message span,
.webgl-fallback-message small {
  color: #8b949e;
}

.remote-pick-labels-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

.remote-pick-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  color: #fff;
  background: rgba(13, 17, 23, 0.88);
  border: 2px solid currentColor;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -100%);
  margin-top: -6px;
  pointer-events: none;
}

.remote-pick-avatar,
.timeline-user-avatar,
.oh-avatar,
.ph-avatar,
.vgu-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.18);
  color: #79c0ff;
  font-weight: 800;
  background-size: cover !important;
  background-position: center !important;
  overflow: hidden;
}

.remote-pick-avatar {
  width: 18px;
  height: 18px;
  font-size: 0.62rem;
}

.remote-pick-avatar--image,
.timeline-user-avatar--image,
.oh-avatar--image,
.ph-avatar--image,
.vgu-avatar--image {
  color: transparent;
}

.viewport-generation-user {
  position: absolute;
  left: 14px;
  top: 14px;
  right: auto;
  z-index: 24;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100% - 28px));
  padding: 8px 10px;
  border: 1px solid rgba(88, 166, 255, 0.42);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.88);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.viewport-generation-user--rigging {
  border-color: rgba(249, 115, 22, 0.58);
  background: linear-gradient(135deg, rgba(54, 28, 12, 0.94), rgba(13, 17, 23, 0.9));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(249, 115, 22, 0.18);
}

.viewport-generation-user--prompt,
.viewport-generation-user--render {
  border-color: rgba(163, 113, 247, 0.58);
  background: linear-gradient(135deg, rgba(42, 24, 64, 0.94), rgba(13, 17, 23, 0.9));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(163, 113, 247, 0.2);
}

.viewport-generation-user--v2 {
  border-color: rgba(210, 153, 34, 0.58);
  background: linear-gradient(135deg, rgba(43, 32, 12, 0.94), rgba(13, 17, 23, 0.9));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(210, 153, 34, 0.2);
}

.vgu-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.viewport-generation-user--rigging .vgu-avatar {
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
}

.viewport-generation-user--prompt .vgu-avatar,
.viewport-generation-user--render .vgu-avatar {
  background: rgba(163, 113, 247, 0.2);
  color: #d2a8ff;
  box-shadow: 0 0 0 2px rgba(163, 113, 247, 0.35);
}

.viewport-generation-user--v2 .vgu-avatar {
  background: rgba(210, 153, 34, 0.2);
  color: #f2cc60;
  box-shadow: 0 0 0 2px rgba(210, 153, 34, 0.35);
}

.vgu-kind-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.16);
  color: #fb923c;
  flex: 0 0 auto;
}

.vgu-kind-icon svg {
  width: 15px;
  height: 15px;
}

.vgu-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.vgu-copy strong,
.vgu-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vgu-copy small {
  color: var(--muted);
  font-size: 0.68rem;
}

.vgu-ai {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.16);
  color: #79c0ff;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.viewport-generation-user--rigging .vgu-ai {
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
}

.viewport-generation-user--prompt .vgu-ai,
.viewport-generation-user--render .vgu-ai {
  background: rgba(163, 113, 247, 0.2);
  color: #d2a8ff;
}

.viewport-generation-user--v2 .vgu-ai {
  background: rgba(210, 153, 34, 0.2);
  color: #f2cc60;
}

#viewport.pick-mode {
  cursor: crosshair;
}

.viewport-selection-marquee {
  position: absolute;
  z-index: 6;
  border: 1px solid rgba(88, 166, 255, 0.95);
  background: rgba(88, 166, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(13, 17, 23, 0.45);
  pointer-events: none;
}

.viewport-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #1f6febdd;
  border: 1px solid #58a6ff;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 4px 20px #0008;
}

.viewport-hint.hidden { display: none; }

.viewport-hint strong { display: block; margin-bottom: 2px; }

.viewport-view-bar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 12;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.viewport-shot-control,
.viewport-transparent-control {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
}

.viewport-transparent-control .viewport-view-btn:first-child {
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
}

.viewport-transparent-options {
  min-width: 28px;
  padding-left: 8px;
  padding-right: 8px;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
}

.viewport-transparent-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: 248px;
  padding: 6px;
  border: 1px solid rgba(139, 148, 158, 0.32);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.viewport-transparent-menu button {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.viewport-transparent-menu button:hover,
.viewport-transparent-menu button.active {
  border-color: rgba(88, 166, 255, 0.36);
  background: rgba(88, 166, 255, 0.12);
}

.viewport-transparent-menu strong {
  font-size: 0.78rem;
}

.viewport-transparent-menu span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.viewport-shot-control .viewport-view-btn--shot {
  min-width: 30px;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 0.9rem;
  line-height: 1;
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
}

.viewport-shot-options {
  min-width: 28px;
  padding-left: 8px;
  padding-right: 8px;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
}

.viewport-shot-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: 236px;
  padding: 6px;
  border: 1px solid rgba(139, 148, 158, 0.32);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.viewport-shot-menu button {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.viewport-shot-menu button:hover,
.viewport-shot-menu button.active {
  border-color: rgba(88, 166, 255, 0.36);
  background: rgba(88, 166, 255, 0.12);
}

.viewport-shot-menu strong {
  font-size: 0.78rem;
}

.viewport-shot-menu span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.viewport-shot-crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 1100;
  cursor: crosshair;
  background: rgba(1, 4, 9, 0.28);
  pointer-events: auto;
}

.viewport-shot-crop-tip {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  padding: 8px 12px;
  border: 1px solid rgba(88, 166, 255, 0.42);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.92);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
}

.viewport-shot-crop-box {
  position: absolute;
  border: 2px solid #58a6ff;
  background: rgba(88, 166, 255, 0.14);
  box-shadow:
    0 0 0 9999px rgba(1, 4, 9, 0.36),
    0 0 24px rgba(88, 166, 255, 0.44);
}

.screenshot-pref-card {
  max-width: 520px;
}

.screenshot-pref-options {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.screenshot-pref-options button {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.screenshot-pref-options button:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.12);
}

.screenshot-pref-options span {
  color: var(--muted);
  font-size: 0.76rem;
}

.viewport-tool-stack {
  position: absolute;
  left: 14px;
  top: 12px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: auto;
}

.viewport-view-btn {
  border: 1px solid rgba(139, 148, 158, 0.35);
  background: rgba(13, 17, 23, 0.82);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.viewport-view-btn:hover {
  background: rgba(33, 38, 45, 0.92);
  color: var(--text);
}

.viewport-view-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(31, 111, 235, 0.12);
}

.viewport-view-btn--paint {
  border-color: rgba(236, 72, 153, 0.42);
  color: #f9a8d4;
  background:
    radial-gradient(circle at 15% 0%, rgba(236, 72, 153, 0.18), transparent 48%),
    rgba(13, 17, 23, 0.86);
}

.viewport-view-btn--paint:hover,
.viewport-view-btn--paint.active {
  border-color: rgba(244, 114, 182, 0.78);
  color: #fbcfe8;
  background: rgba(131, 24, 67, 0.28);
}

.viewport-view-btn--rig {
  border-color: rgba(249, 115, 22, 0.5);
  color: #fbbf24;
  background:
    radial-gradient(circle at 15% 0%, rgba(249, 115, 22, 0.2), transparent 48%),
    rgba(13, 17, 23, 0.86);
}

.viewport-view-btn--rig:hover,
.viewport-view-btn--rig.active {
  border-color: rgba(251, 146, 60, 0.85);
  color: #fed7aa;
  background: rgba(154, 52, 18, 0.32);
}

.viewport-remix-btn {
  border-color: rgba(34, 197, 94, 0.55);
  color: #4ade80;
  background:
    radial-gradient(circle at 15% 0%, rgba(34, 197, 94, 0.2), transparent 48%),
    rgba(13, 17, 23, 0.86);
}

.viewport-remix-btn:hover {
  border-color: rgba(74, 222, 128, 0.85);
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.32);
}

.sim-motion-card {
  max-width: 520px;
}

.sim-motion-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 14px 0 10px;
}

.viewport-lighting-tab {
  position: absolute;
  left: 14px;
  bottom: 54px;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(260px, calc(100% - 28px));
  padding: 8px 10px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.86);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.viewport-lighting-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.viewport-light-slider {
  flex: 1 1 auto;
  min-width: 92px;
  accent-color: var(--accent);
  cursor: pointer;
}

.viewport-light-value {
  flex: 0 0 38px;
  color: #79c0ff;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mobile-showcase-bar,
.mobile-pick-tray,
.mobile-model-picker,
.mobile-corner-launchers,
.mobile-corner-sheet,
.mobile-backdrop,
.mobile-sheet,
#mobile-tools-sheet {
  display: none;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(1, 4, 9, 0.55);
  backdrop-filter: blur(2px);
}

.mobile-backdrop.hidden {
  display: none !important;
}

.mobile-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 190;
  max-height: min(58dvh, 520px);
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  background: #0d1117;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.45);
  transform: translateY(110%);
  transition: transform 0.24s ease;
  overflow: hidden;
}

.mobile-sheet.mobile-open {
  transform: translateY(0);
}

.mobile-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: #161b22;
}

.mobile-sheet-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.mobile-sheet-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.mobile-sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 9px 12px calc(12px + env(safe-area-inset-bottom));
}

.mobile-tool-section + .mobile-tool-section {
  margin-top: 14px;
}

.mobile-tool-heading {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mobile-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-tool-btn {
  min-height: 40px;
}

.mobile-ribbon-slot {
  min-height: 0;
}

body.mobile-sheet-open {
  overflow: hidden;
}

@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  .mobile-backdrop:not(.hidden) {
    display: block;
  }

  .mobile-sheet {
    display: flex;
  }

  body.is-mobile .sidebar.left.mobile-open,
  body.is-mobile .sidebar.right.mobile-open {
    display: flex !important;
    position: fixed;
    z-index: 185;
    inset: auto max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
    max-height: min(58dvh, 520px);
    padding-top: 0;
    border: 1px solid rgba(88, 166, 255, 0.28);
    border-radius: 18px;
    background: rgba(13, 17, 23, 0.96);
    box-shadow: 0 -18px 54px rgba(0, 0, 0, 0.55);
    overflow: auto;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
}

.mobile-showcase-bar {
  position: absolute;
  top: calc(max(8px, env(safe-area-inset-top, 0px)) + 48px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.mobile-showcase-btn {
  pointer-events: auto;
  border: 1px solid rgba(139, 148, 158, 0.48);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.88);
  color: #e6edf3;
  min-height: 34px;
  padding: 7px 11px;
  font-weight: 750;
  font-size: 0.76rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
}

.mobile-showcase-btn:first-child {
  border-color: rgba(88, 166, 255, 0.65);
  background: rgba(31, 111, 235, 0.82);
}

.mobile-pick-tray {
  position: absolute;
  left: 50%;
  bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 56px);
  transform: translateX(-50%);
  z-index: 44;
  width: min(94vw, 540px);
  padding: 6px;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  pointer-events: auto;
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 999px;
  background: rgba(8, 13, 22, 0.82);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mobile-pick-tray::-webkit-scrollbar {
  display: none;
}

.mobile-pick-btn {
  flex: 0 0 auto;
  min-width: 62px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.mobile-tools-fab {
  display: none;
}

.mobile-tools-popup {
  display: none;
}

@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  .mobile-pick-tray {
    display: flex;
  }

  .mobile-tools-fab {
    display: inline-flex;
    position: absolute;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 112px);
    z-index: 45;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(88, 166, 255, 0.48);
    border-radius: 16px;
    background: rgba(13, 17, 23, 0.82);
    color: #dbeafe;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .mobile-tools-popup:not(.hidden) {
    display: grid;
    position: absolute;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 164px);
    z-index: 46;
    grid-template-columns: repeat(2, minmax(92px, 1fr));
    gap: 8px;
    width: min(76vw, 260px);
    max-height: min(54vh, 420px);
    overflow: auto;
    padding: 10px;
    border: 1px solid rgba(88, 166, 255, 0.36);
    border-radius: 18px;
    background: rgba(9, 14, 24, 0.94);
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-tools-popup button {
    min-height: 44px;
    padding: 10px 8px;
    border: 1px solid rgba(139, 148, 158, 0.28);
    border-radius: 13px;
    background: rgba(22, 27, 34, 0.86);
    color: var(--text);
    font-weight: 800;
    font-size: 0.84rem;
  }

  body.mobile-left-panel-open .mobile-tools-fab,
  body.mobile-right-panel-open .mobile-tools-fab,
  body.mobile-left-panel-open .mobile-tools-popup,
  body.mobile-right-panel-open .mobile-tools-popup,
  body.mobile-left-panel-open .mobile-pick-tray,
  body.mobile-right-panel-open .mobile-pick-tray,
  body.mobile-sheet-open .mobile-pick-tray {
    display: none;
  }
}

.mobile-model-picker {
  position: absolute;
  inset: 0;
  z-index: 70;
}

.mobile-model-picker.hidden {
  display: none !important;
}

.mobile-model-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.46);
  backdrop-filter: blur(4px);
}

.mobile-model-picker-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  max-height: min(58dvh, 460px);
  border: 1px solid rgba(88, 166, 255, 0.45);
  border-radius: 18px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.56);
  overflow: hidden;
}

.mobile-model-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.85);
}

.mobile-model-picker-head strong,
.mobile-model-picker-head span {
  display: block;
}

.mobile-model-picker-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.mobile-model-picker-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
}

.mobile-model-list {
  max-height: calc(min(58dvh, 460px) - 62px);
  overflow: auto;
  padding: 8px;
}

.mobile-model-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mobile-model-item.active {
  border-color: rgba(88, 166, 255, 0.7);
  background: rgba(88, 166, 255, 0.14);
}

.mobile-model-item strong,
.mobile-model-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-model-item span,
.mobile-model-format {
  color: var(--muted);
  font-size: 0.76rem;
}

.mobile-corner-launchers {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 42;
}

.mobile-corner-btn {
  pointer-events: auto;
  position: absolute;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(139, 148, 158, 0.45);
  border-radius: 15px;
  background: rgba(13, 17, 23, 0.82);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-weight: 800;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-corner-btn:active {
  transform: scale(0.94);
  background: rgba(22, 27, 34, 0.95);
  border-color: rgba(88, 166, 255, 0.55);
}

.mobile-corner-btn--tl { top: 14px; left: 14px; }
.mobile-corner-btn--tr { top: 14px; right: 14px; }
.mobile-corner-btn--br { right: 14px; bottom: max(18px, env(safe-area-inset-bottom)); }
.mobile-corner-btn--bl { left: 14px; bottom: max(18px, env(safe-area-inset-bottom)); }

.mobile-corner-sheet {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(1, 4, 9, 0.36);
  backdrop-filter: blur(3px);
}

.mobile-corner-sheet.hidden {
  display: none !important;
}

.mobile-corner-sheet-card {
  position: absolute;
  left: max(8px, env(safe-area-inset-left, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: max(8px, env(safe-area-inset-bottom, 0px));
  max-height: min(62dvh, 520px);
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  border: 1px solid rgba(88, 166, 255, 0.26);
  border-radius: 18px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 -18px 54px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mobile-corner-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-right: 2px;
}

.mobile-corner-sheet-head strong {
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.mobile-corner-sheet-close {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(139, 148, 158, 0.4);
  border-radius: 14px;
  background: rgba(22, 27, 34, 0.9);
  color: var(--text);
  font-size: 1.55rem;
  line-height: 1;
}

.mobile-corner-sheet-actions {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-bottom: 12px;
}

.mobile-corner-action {
  width: 100%;
  display: grid;
  gap: 2px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 12px;
  background: rgba(22, 27, 34, 0.92);
  color: var(--text);
  padding: 10px 11px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-corner-action:active {
  transform: scale(0.985);
  border-color: rgba(88, 166, 255, 0.5);
  background: rgba(31, 111, 235, 0.16);
}

.mobile-corner-action span {
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.2;
}

.mobile-corner-action small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.mobile-panel-close {
  display: none;
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  z-index: 95;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(139, 148, 158, 0.48);
  border-radius: 16px;
  background: rgba(22, 27, 34, 0.94);
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}

@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  .mobile-corner-launchers {
    display: block;
  }

  .mobile-corner-sheet:not(.hidden) {
    display: block;
  }
}

/* ── Fusion-style view cube ─────────────────────────────────────────────── */
.view-cube {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 12;
  width: 118px;
  height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
}

.viewport-corner-tools {
  position: absolute;
  top: 154px;
  right: 14px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.viewport-corner-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.82);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.viewport-corner-btn:hover {
  border-color: rgba(88, 166, 255, 0.55);
  color: #58a6ff;
}

.viewport-corner-btn.active {
  border-color: rgba(88, 166, 255, 0.7);
  background: rgba(31, 111, 235, 0.28);
  color: #79c0ff;
}

.viewport-units-bar {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(139, 148, 158, 0.32);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.84);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.viewport-measure-readout {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 13;
  min-width: 148px;
  max-width: min(280px, calc(100% - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  color: var(--text);
}

.viewport-measure-readout.hidden {
  display: none;
}

.viewport-measure-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #79c0ff;
  font-variant-numeric: tabular-nums;
}

.viewport-measure-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.viewport-measure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.viewport-measure-mode-btn,
.viewport-measure-action-btn {
  appearance: none;
  border: 1px solid rgba(139, 148, 158, 0.35);
  background: rgba(22, 27, 34, 0.9);
  color: var(--text);
  border-radius: 7px;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}

.viewport-measure-mode-btn:hover,
.viewport-measure-action-btn:hover {
  border-color: rgba(88, 166, 255, 0.55);
  color: #79c0ff;
}

.viewport-measure-mode-btn.active {
  border-color: rgba(88, 166, 255, 0.75);
  background: rgba(31, 111, 235, 0.28);
  color: #79c0ff;
}

.viewport-units-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.viewport-unit-select,
.viewport-units-bar .unit-select {
  min-width: 64px;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 0.78rem;
}

.view-cube-label {
  padding: 2px 8px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.72);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.view-cube-label:hover {
  color: #58a6ff;
  border-color: rgba(88, 166, 255, 0.45);
}

.view-cube-stage {
  width: 92px;
  height: 92px;
  perspective: 520px;
  display: grid;
  place-items: center;
  cursor: grab;
}

.view-cube--dragging .view-cube-stage {
  cursor: grabbing;
}

.view-cube-body {
  position: relative;
  width: 56px;
  height: 56px;
  transform-style: preserve-3d;
  /* Z-up world: +Y front / +Z top mapped onto CSS 3D cube (+Z front default). */
  transform: rotateX(90deg);
}

.view-cube-spin {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.12s ease-out;
}

.view-cube--dragging .view-cube-spin {
  transition: none;
}

.view-cube-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(88, 166, 255, 0.48);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(235, 241, 248, 0.92), rgba(139, 148, 158, 0.88));
  color: #1f2937;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 5px 16px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  backface-visibility: hidden;
}

.view-cube-face:hover {
  border-color: #58a6ff;
  background: linear-gradient(145deg, #ffffff, #9fc7ff);
  color: #0d1117;
}

.view-cube-face--front { transform: translateZ(28px); }
.view-cube-face--back { transform: rotateY(180deg) rotateZ(180deg) translateZ(28px); }
.view-cube-face--right { transform: rotateY(90deg) translateZ(28px); }
.view-cube-face--left { transform: rotateY(-90deg) translateZ(28px); }
.view-cube-face--top {
  transform: rotateX(90deg) rotateZ(180deg) translateZ(28px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(159, 199, 255, 0.95));
  border-color: rgba(88, 166, 255, 0.72);
}
.view-cube-face--bottom { transform: rotateX(-90deg) translateZ(28px); }

/* ── Viewport generating spinner + error banner ─────────────────────────── */
.viewport-overlay-root {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.viewport-status-toast-stack {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 31;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
  transition: bottom 0.2s ease;
}

.viewport-status-toast-stack.is-generating {
  bottom: 252px;
}

.viewport-overlay-root:has(.viewport-spinner--expanded:not(.hidden)) .viewport-status-toast-stack.is-generating {
  bottom: min(640px, calc(74vh + 34px));
}

@media (max-width: 820px), (pointer: coarse) and (max-width: 1024px) {
  .viewport-status-toast-stack.is-generating {
    bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 300px);
  }
}

.viewport-status-toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.88);
  color: #e6edf3;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
  box-shadow: 0 14px 32px rgba(1, 4, 9, 0.34);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  backdrop-filter: blur(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.viewport-status-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.viewport-status-toast.is-leaving {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
}

.viewport-status-toast-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #58a6ff;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.64);
}

.viewport-status-toast--loading .viewport-status-toast-dot {
  background: #f0c040;
  box-shadow: 0 0 12px rgba(240, 192, 64, 0.68);
}

.viewport-status-toast--ok .viewport-status-toast-dot {
  background: #3fb950;
  box-shadow: 0 0 12px rgba(63, 185, 80, 0.66);
}

.viewport-status-toast--error {
  border-color: rgba(248, 81, 73, 0.42);
}

.viewport-status-toast--error .viewport-status-toast-dot {
  background: #f85149;
  box-shadow: 0 0 12px rgba(248, 81, 73, 0.66);
}

.viewport-status-toast-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewport-spinner {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: auto;
  top: auto;
  width: min(300px, calc(100% - 28px));
  max-width: calc(100% - 28px);
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 12px;
  background: rgba(22, 27, 34, 0.92);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.viewport-spinner--expanded {
  width: min(460px, calc(100% - 28px));
  max-height: min(74vh, 560px);
  overflow: hidden;
}

.viewport-stop-btn,
.viewport-spinner-expand {
  pointer-events: auto;
}

.viewport-stop-btn {
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.viewport-spinner.hidden {
  display: none;
}

.viewport-spinner-visual {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin-top: 0;
  position: relative;
}

.viewport-spinner-ring {
  width: 28px;
  height: 28px;
  margin: 4px;
  border: 2px solid rgba(88, 166, 255, 0.25);
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: viewport-spin 0.85s linear infinite;
}

.viewport-spinner-v2 {
  display: none;
  position: absolute;
  inset: 0;
}

.viewport-spinner-fusion {
  display: none;
  position: absolute;
  inset: 0;
}

.viewport-spinner--v2 {
  border-color: rgba(212, 160, 23, 0.42);
  background: rgba(26, 22, 14, 0.94);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(212, 160, 23, 0.12),
    0 0 32px rgba(212, 160, 23, 0.14);
}

.viewport-spinner--v2 .viewport-spinner-ring {
  display: none;
}

.viewport-spinner--v2 .viewport-spinner-v2 {
  display: block;
}

.viewport-spinner--fusion {
  border-color: rgba(88, 166, 255, 0.68);
  background:
    radial-gradient(circle at 18% 0%, rgba(56, 189, 248, 0.26), transparent 46%),
    linear-gradient(135deg, rgba(8, 47, 73, 0.96), rgba(13, 17, 23, 0.94));
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(88, 166, 255, 0.18),
    0 0 38px rgba(56, 189, 248, 0.2);
}

.viewport-spinner--fusion .viewport-spinner-ring {
  display: none;
}

.viewport-spinner--fusion .viewport-spinner-fusion {
  display: block;
}

.viewport-spinner--rigging {
  border-color: rgba(249, 115, 22, 0.58);
  background:
    radial-gradient(circle at 18% 0%, rgba(249, 115, 22, 0.22), transparent 46%),
    linear-gradient(135deg, rgba(54, 28, 12, 0.96), rgba(13, 17, 23, 0.94));
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(249, 115, 22, 0.16),
    0 0 38px rgba(249, 115, 22, 0.16);
}

.viewport-spinner--rigging .viewport-spinner-ring {
  border-color: rgba(249, 115, 22, 0.2);
  border-top-color: #fb923c;
  filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.55));
}

.fusion-loader-ring {
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #7dd3fc;
  border-right-color: rgba(96, 165, 250, 0.72);
  border-bottom-color: rgba(14, 165, 233, 0.34);
  animation: fusion-loader-revolve 1.15s linear infinite;
  filter: drop-shadow(0 0 8px rgba(125, 211, 252, 0.7));
}

.fusion-loader-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 42% 58% 52% 48%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.42), rgba(96, 165, 250, 0.08));
  animation: fusion-loader-melt 1.8s ease-in-out infinite;
}

.fusion-loader-core {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dff6ff;
  font-size: 1.05rem;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(125, 211, 252, 0.9);
  animation: fusion-core-pulse 1.45s ease-in-out infinite;
}

.fusion-loader-drop {
  position: absolute;
  width: 5px;
  height: 9px;
  border-radius: 999px;
  background: #7dd3fc;
  box-shadow: 0 0 9px rgba(125, 211, 252, 0.8);
  opacity: 0;
  animation: fusion-loader-drip 1.45s ease-in-out infinite;
}

.fusion-loader-drop--a { left: 16px; bottom: -1px; animation-delay: 0s; }
.fusion-loader-drop--b { left: 24px; bottom: 1px; animation-delay: 0.24s; }
.fusion-loader-drop--c { left: 9px; bottom: 3px; animation-delay: 0.48s; }

.v2-orbit {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
}

.v2-orbit--outer {
  inset: 0;
  border-top-color: #f0c040;
  border-right-color: rgba(212, 160, 23, 0.35);
  animation: v2-orbit-spin 1.35s linear infinite;
}

.v2-orbit--inner {
  inset: 6px;
  border-bottom-color: #d4a017;
  border-left-color: rgba(240, 192, 64, 0.45);
  animation: v2-orbit-spin-reverse 0.95s linear infinite;
}

.v2-orbit-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f0c040;
  text-shadow: 0 0 10px rgba(240, 192, 64, 0.65);
  animation: v2-badge-pulse 1.8s ease-in-out infinite;
}

.viewport-spinner--v2 .viewport-progress-track {
  background: rgba(212, 160, 23, 0.14);
  border-color: rgba(212, 160, 23, 0.32);
}

.viewport-spinner--multi .viewport-progress {
  display: none;
}

.viewport-gen-jobs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 4px;
  min-width: 0;
  max-width: 100%;
  max-height: 180px;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: auto;
}

.viewport-gen-jobs.hidden {
  display: none;
}

.viewport-gen-job {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 8px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  text-align: left;
  font: inherit;
}

.viewport-gen-job:hover,
.viewport-gen-job.is-selected {
  border-color: rgba(121, 192, 255, 0.55);
  background: rgba(121, 192, 255, 0.08);
}

.viewport-gen-job-top,
.viewport-gen-job-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
}

.viewport-gen-job-focus {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.viewport-gen-job-index {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b949e;
}

.viewport-gen-job-prompt {
  min-width: 0;
  max-width: 100%;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewport-gen-job-pct {
  font-size: 0.68rem;
  font-weight: 700;
  color: #7ee787;
  flex-shrink: 0;
}

.viewport-gen-job-track {
  display: block;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.viewport-gen-job-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3fb950, #79c0ff);
}

.viewport-gen-job-label {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  font-size: 0.64rem;
  color: #8b949e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewport-gen-job-more {
  font-size: 0.64rem;
  font-weight: 600;
  color: #79c0ff;
  flex-shrink: 0;
}

.viewport-gen-job-expanded {
  display: none;
}

.viewport-gen-jobs--expanded {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.viewport-gen-jobs--expanded .viewport-gen-job {
  min-height: 176px;
  align-content: start;
  gap: 7px;
  padding: 9px;
}

.viewport-gen-jobs--expanded .viewport-gen-job-expanded {
  display: grid;
  gap: 6px;
}

.viewport-gen-job-log-title {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b949e;
}

.viewport-gen-job-logs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  min-width: 0;
  max-height: 96px;
  overflow-x: hidden;
  overflow-y: auto;
}

.viewport-gen-job-log {
  display: grid;
  min-width: 0;
  gap: 1px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.66rem;
  line-height: 1.3;
  color: #c9d1d9;
}

.viewport-gen-job-log > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.viewport-gen-job-log.muted {
  border-top: 0;
  color: #8b949e;
}

.viewport-gen-job-log-stage {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8b949e;
}

.viewport-gen-job-stop {
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.72rem;
  box-sizing: border-box;
}

.viewport-spinner--multi {
  width: min(360px, calc(100vw - 28px));
  min-width: 0;
  max-width: min(360px, calc(100vw - 28px));
}

.viewport-spinner--multi.viewport-spinner--expanded {
  width: min(460px, calc(100% - 28px));
  max-width: min(460px, calc(100vw - 28px));
}

.viewport-spinner--multi.viewport-spinner--expanded .viewport-stop-btn {
  display: none;
}

.prompt-generate-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.generation-cancel-modal .generation-cancel-card {
  width: min(560px, calc(100vw - 24px));
  max-height: min(86vh, 720px);
  overflow: auto;
}

.generation-cancel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 18px;
}

.generation-cancel-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.generation-cancel-row.is-focused,
.generation-cancel-row.is-expanded {
  border-color: rgba(121, 192, 255, 0.45);
}

.generation-cancel-expand {
  border: 0;
  background: transparent;
  color: #79c0ff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

.generation-cancel-prompt {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

.generation-cancel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.72rem;
  color: #8b949e;
}

.generation-cancel-track {
  margin-top: 8px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.generation-cancel-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3fb950, #79c0ff);
}

.generation-cancel-details {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
}

.generation-cancel-details pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0 10px;
  max-height: 140px;
  overflow: auto;
  font-size: 0.74rem;
}

.generation-cancel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.viewport-spinner--v2 .viewport-progress-fill {
  background: linear-gradient(90deg, #8b6914, #d4a017 55%, #f0c040);
  box-shadow: 0 0 14px rgba(240, 192, 64, 0.48);
}

.viewport-spinner--v2 .viewport-progress-pct {
  color: #f0c040;
}

.viewport-spinner--fusion .viewport-progress-track {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(125, 211, 252, 0.35);
}

.viewport-spinner--fusion .viewport-progress-fill {
  background: linear-gradient(90deg, #0284c7, #38bdf8 55%, #bfdbfe);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.62);
}

.viewport-spinner--fusion .viewport-progress-pct {
  color: #7dd3fc;
}

.viewport-spinner--rigging .viewport-progress-track {
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(253, 186, 116, 0.35);
}

.viewport-spinner--rigging .viewport-progress-fill {
  background: linear-gradient(90deg, #c2410c, #f97316 55%, #fdba74);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.62);
}

.viewport-spinner--rigging .viewport-progress-pct {
  color: #fdba74;
}

@keyframes viewport-spin {
  to { transform: rotate(360deg); }
}

@keyframes v2-orbit-spin {
  to { transform: rotate(360deg); }
}

@keyframes v2-orbit-spin-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes v2-badge-pulse {
  0%, 100% { opacity: 0.82; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes fusion-loader-revolve {
  to { transform: rotate(360deg); }
}

@keyframes fusion-loader-melt {
  0%, 100% { border-radius: 42% 58% 52% 48%; transform: scale(0.92) translateY(-1px); opacity: 0.7; }
  50% { border-radius: 58% 42% 46% 54%; transform: scale(1.08) translateY(2px); opacity: 1; }
}

@keyframes fusion-core-pulse {
  0%, 100% { transform: scale(1); opacity: 0.88; }
  50% { transform: scale(1.14); opacity: 1; }
}

@keyframes fusion-loader-drip {
  0% { transform: translateY(-5px) scaleY(0.4); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(12px) scaleY(1.25); opacity: 0; }
}

.viewport-spinner-label {
  margin: 0;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  font-size: 0.82rem;
  font-weight: 500;
  color: #e6edf3;
  line-height: 1.35;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.viewport-spinner-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viewport-spinner-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.viewport-spinner-expand {
  flex: 0 0 auto;
  margin: 0;
  padding: 2px 8px;
  border: 1px solid rgba(139, 148, 158, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #c9d1d9;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.viewport-spinner-expand:hover {
  border-color: rgba(88, 166, 255, 0.55);
  color: #e6edf3;
  background: rgba(88, 166, 255, 0.12);
}

.viewport-spinner--v2 .viewport-spinner-expand:hover {
  border-color: rgba(240, 192, 64, 0.55);
  background: rgba(240, 192, 64, 0.12);
}

.viewport-spinner-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 8px 2px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: auto;
}

.viewport-agent-prompt-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.viewport-agent-prompt-wrap.hidden {
  display: none;
}

.viewport-agent-prompt-text {
  margin: 0;
  padding: 8px 10px;
  max-height: min(22vh, 180px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.7rem;
  line-height: 1.45;
  color: #e6edf3;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.viewport-spinner-details.hidden {
  display: none;
}

.viewport-agent-thinking-label,
.viewport-agent-section-title {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b949e;
  margin-bottom: 4px;
}

.viewport-agent-thinking-text {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #e6edf3;
}

.viewport-agent-checklist,
.viewport-agent-activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.viewport-agent-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.72rem;
  line-height: 1.3;
  color: #8b949e;
}

.viewport-agent-check--done {
  color: #3fb950;
}

.viewport-agent-check--active {
  color: #e6edf3;
}

.viewport-agent-check-mark {
  flex: 0 0 14px;
  width: 14px;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.3;
}

.viewport-agent-check-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viewport-agent-check-detail {
  font-size: 0.66rem;
  color: #8b949e;
}

.viewport-agent-check-repair {
  font-size: 0.64rem;
  color: #fbbf24;
}

.viewport-spinner--repair .viewport-spinner-label,
.viewport-spinner--repair .viewport-progress-step {
  color: #fde68a;
}

.viewport-agent-activity-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #c9d1d9;
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.viewport-agent-activity-item.muted {
  color: #8b949e;
  border-top: 0;
}

.viewport-agent-activity-stage {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b949e;
}

.viewport-spinner--v2 .viewport-agent-check--active {
  color: #f0c040;
}

.viewport-spinner--v2 .viewport-agent-check--done {
  color: #d4a017;
}

.viewport-progress {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.viewport-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.18);
  border: 1px solid rgba(88, 166, 255, 0.28);
  overflow: hidden;
}

.viewport-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f6feb, #58a6ff);
  transition: width 0.35s ease-out;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.45);
}

.viewport-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  font-size: 0.75rem;
  color: #c9d1d9;
}

.viewport-progress-step {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, #c9d1d9 85%, transparent);
}

.viewport-progress-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #79c0ff;
}

.viewport-progress-eta {
  color: #8b949e;
}

.viewport-error-banner {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(92%, 560px);
  width: max-content;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px 34px 12px 16px;
  border: 1px solid rgba(248, 81, 73, 0.55);
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.96);
  color: #f85149;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: border-color 0.15s, background 0.15s;
}

.viewport-error-banner:hover {
  border-color: #f85149;
  background: rgba(33, 38, 45, 0.98);
}

.viewport-error-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #ffa198;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.viewport-error-close:hover,
.viewport-error-close:focus-visible {
  background: rgba(248, 81, 73, 0.18);
  color: #ffdcd7;
  outline: none;
}

.viewport-error-banner.hidden {
  display: none;
}

.viewport-error-text {
  display: block;
  max-height: 120px;
  overflow-y: auto;
  word-break: break-word;
  line-height: 1.35;
  white-space: pre-wrap;
}

.viewport-error-hint {
  font-size: 0.7rem;
  color: #8b949e;
  font-weight: 500;
}

.viewport-error-hint--copied {
  color: #3fb950;
}

.reference-panel { margin-bottom: 14px; }

.pick-btn.active {
  border-color: #ff7b72;
  background: #ff7b7222;
  color: #ff7b72;
}

.pick-btn[data-mode="face"].active {
  border-color: #58a6ff;
  background: #1f6feb33;
  color: #58a6ff;
}

.pick-btn[data-mode="edge"].active {
  border-color: #d29922;
  background: #d2992222;
  color: #d29922;
}

.pick-btn[data-mode="lasso"].active {
  border-color: #3fb950;
  background: #3fb95022;
  color: #3fb950;
}

.pick-btn[data-mode="off"].active {
  border-color: var(--muted);
  background: #21262d;
  color: var(--text);
}

.color-tool-panel {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.55);
  display: grid;
  gap: 10px;
}

.color-tool-panel.hidden {
  display: none;
}

.color-tool-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.color-tool-controls,
.color-tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.color-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#color-tool-input {
  width: 42px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
}

.color-swatches {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(240, 246, 252, 0.38);
  background: var(--swatch);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(13, 17, 23, 0.25);
}

.color-swatch:hover,
.color-swatch:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

.timeline-panel {
  flex-shrink: 0;
  height: var(--timeline-height);
  min-height: 118px;
  border-top: 0;
  background: var(--panel);
  padding: 10px 14px 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: height 0.22s cubic-bezier(0.4, 0, 0.2, 1), padding 0.22s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.22s;
}

.timeline-panel.timeline-panel--collapsed {
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border-top-color: transparent;
  overflow: visible;
  pointer-events: none;
}

.timeline-panel.timeline-panel--collapsed .timeline-wrap {
  display: none;
}

#timeline-resize-handle:has(+ .timeline-panel.timeline-panel--collapsed) {
  display: none;
}

/* Collapsed — small tab at bottom center to restore timeline */
.timeline-expand-tab {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 22px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.28);
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.timeline-expand-tab:hover {
  color: var(--accent);
  background: #21262d;
  border-color: var(--accent);
}

.timeline-collapse-btn {
  min-width: 28px;
  padding: 4px 8px;
}

.timeline-panel .timeline-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.wiring-bottom-wrap {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}

#app.wiring-mode .timeline-panel .timeline-wrap {
  display: none;
}

#app.wiring-mode .wiring-bottom-wrap {
  display: flex;
}

#app:not(.wiring-mode) .wiring-bottom-wrap,
.timeline-panel.timeline-panel--collapsed .wiring-bottom-wrap {
  display: none;
}

.wiring-bottom-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.wiring-bottom-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}

.wiring-bottom-tab {
  border: 0;
  border-radius: 6px;
  padding: 5px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.wiring-bottom-tab.active {
  background: #1f6feb;
  color: #fff;
}

.wiring-bottom-summary {
  flex: 1;
}

.wiring-bottom-collapse {
  margin-left: auto;
}

.wiring-bottom-body {
  min-height: 0;
  flex: 1;
}

.wiring-bottom-pane {
  display: none;
  min-height: 0;
  height: 100%;
}

.wiring-bottom-pane.active {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wiring-history-actions,
.wiring-terminal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiring-terminal-actions span {
  flex: 1;
}

.wiring-history-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.wiring-history-step {
  min-width: 160px;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #161b22;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.wiring-history-step:hover {
  border-color: var(--accent);
}

.wiring-history-step--current {
  border-color: rgba(46, 160, 67, 0.65);
  background: rgba(46, 160, 67, 0.1);
  cursor: default;
}

.wiring-history-step--redo {
  border-style: dashed;
}

.wiring-history-step .step-kind,
.wiring-history-step .step-label,
.wiring-history-step .step-user {
  display: block;
}

.wiring-history-step .step-kind {
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.wiring-history-step .step-label {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
}

.wiring-history-step .step-user {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.wiring-terminal-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #0d1117;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
}

.wiring-terminal-line {
  display: flex;
  gap: 8px;
  padding: 2px 0;
  color: #c9d1d9;
}

.wiring-terminal-line span {
  color: #58a6ff;
  flex: 0 0 auto;
}

.wiring-terminal-line--warn {
  color: #d29922;
}

.wiring-terminal-line--error {
  color: #ff7b72;
}

.timeline-panel .timeline-steps {
  flex: 1;
  min-height: 0;
}

/* Draggable split handles */
.resize-handle {
  flex-shrink: 0;
  touch-action: none;
  z-index: 40;
}

.resize-handle--row {
  height: 6px;
  margin: -3px 0;
  cursor: row-resize;
  background: transparent;
  transition: background 0.12s;
}

.resize-handle--row:hover,
.resize-handle--row:focus-visible,
.resize-handle--row:active {
  background: rgba(88, 166, 255, 0.25);
}

.panel-gutter-v {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  cursor: col-resize;
  background: rgba(48, 54, 61, 0.35);
  transition: background 0.12s;
  touch-action: none;
  z-index: 50;
}

.panel-gutter-v:hover,
.panel-gutter-v:focus-visible,
.panel-gutter-v:active {
  background: rgba(88, 166, 255, 0.45);
}

.panel-gutter-v[data-gutter="left-split"] {
  grid-area: left-split;
}

.panel-gutter-v[data-gutter="right-split"] {
  grid-area: right-split;
}

body.panel-resizing {
  user-select: none;
}

body.panel-resizing * {
  cursor: inherit !important;
}

body.panel-resizing-col,
body.panel-resizing-col * {
  cursor: col-resize !important;
}

body.panel-resizing-row,
body.panel-resizing-row * {
  cursor: row-resize !important;
}

.timeline-wrap .timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.timeline-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.timeline-header-main h2 {
  margin: 0;
  flex-shrink: 0;
}

#timeline-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#timeline-slider {
  width: 100%;
  margin: 6px 0 8px;
  accent-color: var(--accent);
}

.timeline-steps {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.timeline-step {
  flex: 0 0 auto;
  max-width: 140px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #21262d;
  color: var(--text);
  font-size: 0.7rem;
  cursor: pointer;
  text-align: left;
}

.timeline-step:hover { border-color: var(--accent); }
.timeline-step.active {
  border-color: var(--accent);
  background: #1f6feb22;
}

.timeline-step--restore {
  border-color: rgba(63, 185, 80, 0.55);
}

.timeline-step--restore.active {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.14);
}

.timeline-step--prompt {
  border-color: rgba(163, 113, 247, 0.5);
  background: rgba(163, 113, 247, 0.08);
}

.timeline-step--prompt:hover {
  border-color: #a371f7;
}

.timeline-step--prompt.active {
  border-color: #a371f7;
  background: rgba(163, 113, 247, 0.18);
}

.timeline-step--prompt .timeline-step-icon {
  border-color: rgba(163, 113, 247, 0.55);
  background: rgba(163, 113, 247, 0.16);
  color: #d2a8ff;
}

.timeline-step--prompt .step-kind {
  color: #c297ff;
}

.timeline-step--prompt .step-user {
  color: #d2a8ff;
}

.timeline-step--render {
  border-color: rgba(163, 113, 247, 0.5);
  background: rgba(163, 113, 247, 0.08);
}

.timeline-step--render:hover,
.timeline-step--render.active {
  border-color: #a371f7;
}

.timeline-step--render.active {
  background: rgba(163, 113, 247, 0.18);
}

.timeline-step--render .timeline-step-icon {
  border-color: rgba(163, 113, 247, 0.55);
  background: rgba(163, 113, 247, 0.16);
  color: #d2a8ff;
}

.timeline-step--render .step-kind {
  color: #c297ff;
}

.timeline-step--render .step-user {
  color: #d2a8ff;
}

.timeline-step--history-only {
  opacity: 0.92;
}

.timeline-step--v2 {
  border-color: rgba(210, 153, 34, 0.58);
  background: rgba(210, 153, 34, 0.1);
}

.timeline-step--v2:hover,
.timeline-step--v2.active {
  border-color: #d29922;
}

.timeline-step--v2.active {
  background: rgba(210, 153, 34, 0.2);
}

.timeline-step--v2 .timeline-step-icon {
  border-color: rgba(210, 153, 34, 0.62);
  background: rgba(210, 153, 34, 0.16);
  color: #f2cc60;
}

.timeline-step--v2 .step-kind {
  color: #f2cc60;
}

.timeline-step--v2 .step-user {
  color: #f2cc60;
}

.timeline-step--pending {
  border-style: dashed;
  opacity: 0.95;
  cursor: default;
  animation: timeline-prompt-pending 1.5s ease-in-out infinite;
}

.timeline-step--pending .timeline-step-icon {
  animation: proj-loading-spin 0.9s linear infinite;
}

@keyframes timeline-prompt-pending {
  0%, 100% { box-shadow: 0 0 0 0 rgba(163, 113, 247, 0.0); }
  50%       { box-shadow: 0 0 0 3px rgba(163, 113, 247, 0.18); }
}

.timeline-step .step-topline {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.timeline-step-icon {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(88, 166, 255, 0.45);
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.12);
  color: var(--accent);
  font-size: 0.68rem;
  line-height: 1;
}

.timeline-user-avatar {
  width: 17px;
  height: 17px;
  font-size: 0.58rem;
}

.timeline-step .step-kind {
  display: block;
  text-transform: uppercase;
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-step .step-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-step .step-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.62rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-step .step-user {
  display: block;
  font-size: 0.62rem;
  color: var(--accent);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-context-menu {
  min-width: 190px;
}

.timeline-context-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.timeline-context-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.folder-context-menu button[data-action="remove"]:hover {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

/* ── Onshape Library panel ──────────────────────────────────────────── */
.onshape-library-logo {
  display: inline-block;
  width: 18px !important;
  height: 18px !important;
  object-fit: contain;
  vertical-align: -3px;
  margin-right: 6px;
  background: transparent;
}

.fusion-library-logo {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: inline-block;
  margin-right: 6px;
  object-fit: contain;
  vertical-align: -3px;
}

.onshape-library-section {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.onshape-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.onshape-library-header h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #aaa);
  display: flex;
  align-items: center;
}

.onshape-status {
  margin: 0 0 6px;
  line-height: 1.35;
}
.onshape-status.error { color: var(--danger, #f85149); }
.fusion-status {
  margin: 0 0 6px;
  line-height: 1.35;
}
.fusion-status.error { color: var(--danger, #f85149); }

.cloud-library-connect {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(88, 166, 255, 0.06);
}

.cloud-library-connect p {
  margin: 0;
  line-height: 1.4;
}

.cloud-library-connect .btn-cloud-connect-now {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cloud-library-connect .btn-cloud-connect-now img {
  display: block;
  border-radius: 3px;
}

.fusion-library-controls {
  display: grid;
  gap: 6px;
  margin: 6px 0;
}

.fusion-library-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 6px;
}

.fusion-library-tab {
  flex: 1;
  border: 1px solid rgba(0, 120, 212, 0.28);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #8b949e);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 8px;
  cursor: pointer;
}

.fusion-library-tab.active {
  background: rgba(0, 120, 212, 0.14);
  color: var(--text);
  border-color: rgba(0, 120, 212, 0.45);
}

.fusion-library-panel.hidden {
  display: none;
}

.fusion-mirrors-summary {
  margin: 0 0 8px;
  line-height: 1.35;
}

.fusion-mirrors-list {
  display: grid;
  gap: 8px;
}

.fusion-mirror-card {
  border: 1px solid rgba(0, 120, 212, 0.22);
  border-radius: 10px;
  background: rgba(0, 120, 212, 0.05);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.fusion-mirror-card.stale {
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.06);
}

.fusion-mirror-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.fusion-mirror-card-title {
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.fusion-mirror-card-badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(46, 160, 67, 0.16);
  color: #3fb950;
}

.fusion-mirror-card.stale .fusion-mirror-card-badge {
  background: rgba(248, 81, 73, 0.16);
  color: #f85149;
}

.fusion-mirror-card-meta {
  margin: 0;
  line-height: 1.4;
}

.fusion-mirror-card-path {
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}

.fusion-mirror-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fusion-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(0, 120, 212, 0.28);
  border-radius: 8px;
  background: rgba(0, 120, 212, 0.08);
}

.fusion-account-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--text);
}

.fusion-mirror-target {
  margin: 0;
  line-height: 1.35;
}

.fusion-mirror-target strong {
  color: var(--text);
  font-weight: 600;
}

.fusion-mirror-stale {
  margin: 0;
  line-height: 1.35;
}

.fusion-mirror-link-modal .fusion-mirror-link-card {
  width: min(560px, calc(100vw - 24px));
  max-height: min(84vh, 760px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fusion-mirror-link-subtitle {
  margin: -4px 0 0;
  line-height: 1.4;
}

.fusion-mirror-link-section {
  display: grid;
  gap: 8px;
}

.fusion-mirror-link-section h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text);
}

.fusion-mirror-people-list,
.fusion-mirror-contents-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.fusion-mirror-person {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.55);
}

.fusion-mirror-person.is-stale {
  border-color: rgba(248, 81, 73, 0.35);
}

.fusion-mirror-person-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(0, 120, 212, 0.22);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
}

.fusion-mirror-person-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.fusion-mirror-person-meta strong {
  font-size: 0.8rem;
}

.fusion-mirror-person-meta span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.fusion-mirror-person-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fusion-mirror-link-mode {
  display: grid;
  gap: 6px;
}

.fusion-mirror-mode-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(13, 17, 23, 0.45);
}

.fusion-mirror-mode-option:has(input:checked) {
  border-color: rgba(0, 120, 212, 0.55);
  background: rgba(0, 120, 212, 0.1);
}

.fusion-mirror-mode-option input {
  margin-top: 3px;
}

.fusion-mirror-mode-option span {
  display: grid;
  gap: 2px;
}

.fusion-mirror-mode-option strong {
  font-size: 0.8rem;
}

.fusion-mirror-mode-option small {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.fusion-mirror-contents-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.4);
}

.fusion-mirror-contents-item.selected {
  border-color: rgba(0, 120, 212, 0.55);
  background: rgba(0, 120, 212, 0.12);
}

.fusion-mirror-file-select {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.fusion-mirror-contents-badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fusion-mirror-contents-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.fusion-mirror-preview {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px dashed rgba(0, 120, 212, 0.35);
  border-radius: 8px;
  background: rgba(0, 120, 212, 0.05);
}

.fusion-mirror-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fusion-mirror-link-actions {
  margin-top: 4px;
}

.fusion-library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fusion-library-field {
  display: grid;
  gap: 3px;
  font-size: 0.68rem;
  color: var(--muted);
}

.fusion-library-field select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2, #161b22);
  color: var(--text);
  font-size: 0.74rem;
}

.onshape-doc-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.onshape-doc-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.onshape-doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  background: var(--surface2, #161b22);
  cursor: default;
}

.onshape-doc-name {
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  color: var(--text);
}

button.onshape-doc-name.fusion-folder-select {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}

button.onshape-doc-name.fusion-folder-select:hover,
.fusion-folder-item.active button.onshape-doc-name.fusion-folder-select {
  color: #7dd3fc;
}

.fusion-folder-header {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.fusion-folder-toggle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  color: var(--text-muted, #8b949e);
}

.fusion-folder-name {
  display: block;
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  color: #e6edf3 !important;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}

.fusion-folder-name:hover,
.fusion-folder-item.active .fusion-folder-name {
  color: #7dd3fc !important;
}

.onshape-doc-toggle {
  flex-shrink: 0;
  color: var(--text-muted, #888);
  transform: rotate(-90deg);
  transition: transform 0.15s;
}

.onshape-doc-elements {
  padding: 4px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg, #0d1117);
}
.onshape-doc-elements.hidden { display: none; }

.fusion-folder-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 8px 8px;
  background: var(--bg, #0d1117);
}
.fusion-folder-panel.fusion-folder-panel-collapsed {
  display: none !important;
}

.fusion-folder-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.9);
}

.fusion-folder-toolbar .btn {
  font-size: 0.68rem;
  padding: 4px 8px;
  white-space: nowrap;
}

.fusion-folder-contents {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fusion-folder-item .onshape-doc-elements {
  margin-left: 7px;
  border-left: 1px solid rgba(88, 166, 255, 0.16);
}

.fusion-file-row {
  padding: 6px 8px;
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-radius: 8px;
  background: rgba(56, 139, 253, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}
.fusion-file-row .onshape-elem-name {
  min-width: 0;
  font-weight: 600;
  color: #e6edf3;
}
.fusion-file-row .btn-fusion-import {
  font-weight: 700;
}

.fusion-folder-hint {
  margin: 4px 0 0;
  line-height: 1.35;
}

.fusion-mirror-contents-item.is-file .fusion-mirror-contents-name {
  flex: 1;
}

.fusion-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.fusion-row-actions .btn {
  font-size: 0.66rem;
  padding: 3px 7px;
  white-space: nowrap;
}

.btn-fusion-push {
  font-size: 0.66rem;
  padding: 3px 6px;
  border: 1px solid rgba(56, 189, 248, 0.42);
  background: rgba(14, 165, 233, 0.12);
  color: #7dd3fc;
}

.btn-fusion-push.success {
  border-color: #2ea043;
  background: rgba(46, 160, 67, 0.18);
  color: #7ee787;
}

.fusion-view-more {
  display: flex;
  width: 100%;
  justify-content: center;
  margin: 6px 0 2px;
  border-style: dashed;
  color: #79c0ff;
  background: rgba(88, 166, 255, 0.08);
}

.fusion-view-more:hover,
.fusion-view-more:focus-visible {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.16);
  color: #a5d6ff;
  outline: none;
}

.fusion-mirror-contents-item.is-more {
  display: flex;
  justify-content: center;
  padding: 6px 0 2px;
}

.fusion-mirror-contents-item.is-more .fusion-view-more {
  width: auto;
  min-width: 60%;
}

.onshape-elem-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.onshape-elem-row--dim {
  opacity: 0.38;
}

.onshape-elem-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-onshape-view {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--accent, #5b8af5);
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent, #5b8af5);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-onshape-view:hover {
  background: rgba(88, 166, 255, 0.2);
}

.btn-onshape-push {
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid #2d5a27;
  background: rgba(46, 160, 67, 0.1);
  color: #7ee787;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}
.btn-onshape-push:hover:not(:disabled) {
  background: rgba(46, 160, 67, 0.22);
}
.btn-onshape-push:disabled { opacity: 0.6; cursor: default; }
.btn-onshape-push.success {
  border-color: #2ea043;
  background: rgba(46, 160, 67, 0.22);
}

.onshape-elem-type-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(88, 166, 255, 0.12);
  color: var(--accent, #5b8af5);
  white-space: nowrap;
}

.onshape-elem-name {
  font-size: 0.75rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.btn-onshape-import {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid #8b2020;
  background: rgba(232, 35, 42, 0.1);
  color: #ff8080;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-onshape-import:hover:not(:disabled) {
  background: rgba(232, 35, 42, 0.22);
  color: #ffaaaa;
}
.btn-onshape-import:disabled { opacity: 0.6; cursor: default; }
.btn-onshape-import.success {
  border-color: #2ea043;
  background: rgba(46, 160, 67, 0.12);
  color: #7ee787;
}

.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* ── End Onshape Library panel ──────────────────────────────────────── */

.object-history-panel {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.project-history-section,
.feature-history-section {
  min-width: 0;
}

.project-history-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.history-section-title {
  margin: 0 0 4px;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.object-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  margin-top: 8px;
}

.feature-history-panel .object-history-list {
  max-height: min(48vh, 420px);
}

.object-history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
}

.object-history-item:hover {
  border-color: var(--accent);
  background: #1f6feb12;
}

.oh-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.oh-kind {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.oh-user {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 500;
}

.oh-label {
  display: block;
  line-height: 1.35;
  margin-bottom: 2px;
}

.oh-meta {
  display: block;
  font-size: 0.66rem;
  color: var(--muted);
}

.oh-summary {
  margin: 4px 0 0;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
}

.oh-model {
  display: block;
  margin-top: 3px;
  font-size: 0.66rem;
  color: #79c0ff;
  font-weight: 600;
}

.object-history-empty {
  padding: 8px 0;
}

.object-history-item.oh-static {
  cursor: default;
  opacity: 0.92;
}

.object-history-item.oh-static:hover {
  border-color: var(--border);
  background: #0d1117;
}

.object-history-item.oh-active {
  border-color: var(--accent);
  background: #1f6feb22;
}

.oh-user {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.oh-avatar {
  width: 18px;
  height: 18px;
  font-size: 0.6rem;
}

.oh-foot {
  display: flex;
  margin-top: 6px;
}

.oh-restore-tag {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.oh-meta-tag {
  font-size: 0.65rem;
  color: var(--muted);
}

.proj-row-actions--menu-only {
  width: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
}

.workspace-activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.workspace-activity-item {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0d1117;
  font-size: 0.72rem;
}

.workspace-activity-item.ws-activity-new {
  border-color: var(--accent);
  background: #1f6feb18;
  animation: ws-flash 1.5s ease-out;
}

@keyframes ws-flash {
  from { background: #1f6feb44; }
  to { background: #1f6feb18; }
}

.ws-act-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.ws-act-kind {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

.ws-act-user {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 500;
}

.ws-act-label {
  display: block;
  margin-top: 2px;
  line-height: 1.3;
}

.ws-act-meta {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 2px;
}

.workspace-activity-empty {
  padding: 4px 0;
}


.folder-share-badge {
  font-size: 0.68rem;
  color: var(--accent);
}

.folder-shared-tag {
  font-size: 0.62rem;
  font-weight: 600;
  color: #bc8cff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.folder-context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 160px;
  padding: 4px;
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.folder-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 4px;
}

.folder-context-menu button:hover {
  background: #1f6feb33;
}

.folder-context-menu button[data-action="delete"]:hover {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

.component-context-menu {
  min-width: 220px;
}

.component-context-title {
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.component-context-title strong,
.component-context-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-context-title strong {
  color: var(--text);
  font-size: 0.84rem;
}

.component-context-title span {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 2px;
}

.folder-context-menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px;
}

.folder-context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.folder-context-menu button[data-action="move"]::after {
  content: "▸";
  float: right;
  color: var(--muted);
  margin-left: 12px;
}

.folder-context-submenu {
  position: fixed;
  z-index: 10001;
  min-width: 180px;
  max-width: min(280px, calc(100vw - 16px));
  max-height: min(320px, calc(100vh - 16px));
  overflow-y: auto;
  padding: 4px;
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.folder-context-submenu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-context-submenu button:hover:not(:disabled) {
  background: #1f6feb33;
}

.folder-context-submenu button:disabled {
  cursor: default;
  opacity: 0.55;
  color: var(--muted);
}

.ref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 4px;
}

.prompt-inline-ref-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-height: 72px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  margin-bottom: -1px;
  padding: 5px 6px 4px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: rgba(13, 17, 23, 0.72);
}

.prompt-ref-count {
  flex: 1 1 100%;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.2;
}

.prompt-inline-ref-chips.hidden {
  display: none;
}

.prompt-inline-ref-chips:not(.hidden) + #prompt-input,
.prompt-inline-ref-chips:not(.hidden) + .prompt-editor-wrap,
.prompt-inline-ref-chips:not(.hidden) + #wiring-prompt-input {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.prompt-editor-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.72);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.prompt-editor-wrap.is-focused {
  border-color: rgba(56, 139, 253, 0.75);
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.15);
}

.prompt-editor {
  min-height: 132px;
  max-height: 280px;
  overflow: auto;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  caret-color: #79c0ff;
}

.prompt-editor.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
  float: left;
  height: 0;
}

.prompt-input--mirror {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.prompt-mention {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: min(220px, 100%);
  margin: 0 1px;
  padding: 0 1px 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(56, 139, 253, 0.45);
  background: rgba(31, 111, 235, 0.22);
  color: #79c0ff;
  font-weight: 650;
  line-height: 1.25;
  vertical-align: baseline;
  user-select: none;
}

.prompt-mention-label {
  font-size: 0.78em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.prompt-mention-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 0.95em;
  line-height: 1;
  padding: 0 5px 0 2px;
  border-radius: 999px;
}

.prompt-mention-remove:hover {
  opacity: 1;
  color: #ff7b72;
  background: rgba(248, 81, 73, 0.12);
}

.prompt-mention-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 6px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(56, 139, 253, 0.35);
  border-radius: 10px;
  background: #0d1117;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.prompt-mention-menu.hidden {
  display: none;
}

.prompt-mention-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.prompt-mention-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 8px 10px;
  cursor: pointer;
}

.prompt-mention-option:hover,
.prompt-mention-option.is-active {
  background: rgba(56, 139, 253, 0.16);
}

.prompt-mention-option-token {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(56, 139, 253, 0.4);
  background: rgba(31, 111, 235, 0.2);
  color: #79c0ff;
  font-size: 0.78rem;
  font-weight: 650;
}

.prompt-mention-option-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.prompt-mention-option-meta strong {
  font-size: 0.88rem;
  color: #e6edf3;
}

.prompt-mention-option-meta small {
  color: var(--muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  background: #1f6feb33;
  border: 1px solid #388bfd66;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.2;
  cursor: pointer;
  min-width: 0;
}

.ref-chip .ref-token {
  color: var(--accent);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ref-chip .ref-coords {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c9d1d9;
  font-family: var(--font);
  font-size: 0.66rem;
}

.ref-chip--inline {
  max-width: min(200px, calc(100% - 8px));
  background: rgba(88, 166, 255, 0.16);
  border-color: rgba(88, 166, 255, 0.55);
  border-radius: 999px;
  box-shadow: none;
  flex: 0 1 auto;
}

.ref-chip--inline .ref-coords {
  display: none;
}

.ref-chip--more {
  background: #21262d;
  border-color: var(--border);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.64rem;
  white-space: nowrap;
  border-radius: 999px;
  max-width: none;
  flex: 0 0 auto;
}

.ref-chip--more:hover {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.55);
  background: rgba(31, 111, 235, 0.13);
}

.ref-summary {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.ref-chip .ref-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.9rem;
  line-height: 1;
}

.ref-chip .ref-remove:hover { color: var(--danger); }

.ref-list {
  margin-bottom: 8px;
  font-size: 0.72rem;
  line-height: 1.5;
}

.ref-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}

.ref-line-details {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-line-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.ref-line-remove:hover,
.ref-line-remove:focus-visible {
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.12);
  color: var(--danger);
  outline: none;
}

.ref-list .ref-line code {
  color: var(--accent);
  background: #21262d;
  padding: 1px 4px;
  border-radius: 3px;
}

.prompt-image-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  border: 1px dashed rgba(88, 166, 255, 0.55);
  border-radius: 10px;
  background: rgba(88, 166, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.78rem;
}

.prompt-image-drop:hover,
.prompt-image-drop.dragging {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.12);
}

.prompt-image-drop strong {
  display: block;
  font-size: 0.78rem;
}

.prompt-image-drop span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
}

.prompt-image-drop.is-loading {
  pointer-events: none;
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.14);
}

.prompt-attach-busy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
}

.prompt-attach-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(88, 166, 255, 0.25);
  border-top-color: var(--accent, #58a6ff);
  border-radius: 50%;
  animation: prompt-attach-spin 0.7s linear infinite;
}

@keyframes prompt-attach-spin {
  to { transform: rotate(360deg); }
}

.prompt-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.prompt-image-card {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0d1117;
}

.prompt-image-card img {
  display: block;
  width: 76px;
  height: 58px;
  object-fit: cover;
  max-width: 76px;
  max-height: 58px;
}

.prompt-image-card span {
  display: block;
  padding: 4px 6px;
  color: var(--muted);
  font-size: 0.62rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-image-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: rgba(248, 81, 73, 0.92);
  color: white;
  cursor: pointer;
  line-height: 1;
}

#viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

section { margin-bottom: 18px; }
section h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.mono { font-family: var(--mono); font-size: 0.78rem; }
.muted { color: var(--muted); }
.small { font-size: 0.75rem; }

.project-browser {
  margin-top: 6px;
}

.project-browser-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0d1117;
}

.project-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #161b22;
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-search-bar:focus-within {
  border-color: rgba(88, 166, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.18);
}

.project-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
}

.project-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  padding: 8px 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.project-search-input::placeholder {
  color: var(--muted);
}

.project-search-input::-webkit-search-decoration,
.project-search-input::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

.project-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.project-search-clear:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.project-search-clear.hidden {
  display: none;
}

.project-search-empty {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #161b22;
  text-align: center;
}

.workspace-browser-section {
  margin-bottom: 12px;
}

.workspace-browser-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  position: relative;
}

.workspace-browser-head h2 {
  margin-bottom: 2px;
}

.shared-workspace-menu {
  position: relative;
  flex-shrink: 0;
}

.shared-workspace-menu-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(251, 133, 0, 0.38);
  border-radius: 9px;
  background: rgba(251, 133, 0, 0.12);
  color: #ffa657;
  cursor: pointer;
}

.shared-workspace-menu-btn:hover,
.shared-workspace-menu-btn[aria-expanded="true"] {
  border-color: rgba(251, 133, 0, 0.62);
  background: rgba(251, 133, 0, 0.2);
}

.shared-workspace-menu-btn[hidden] {
  display: none;
}

.shared-workspace-menu-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #3fb950;
  box-shadow: 0 0 0 2px #0d1117;
}

.shared-workspace-menu-btn.has-hidden-workspaces .shared-workspace-menu-dot {
  background: #f85149;
}

.shared-workspaces-menu {
  position: absolute;
  top: 34px;
  right: 0;
  z-index: 40;
  width: min(260px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid rgba(251, 133, 0, 0.26);
  border-radius: 12px;
  background: #0d1117;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

.shared-workspaces-menu.hidden {
  display: none;
}

.shared-workspaces-menu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.shared-workspaces-menu-title strong {
  font-size: 0.78rem;
}

.shared-workspaces-menu-title small {
  color: var(--muted);
  font-size: 0.68rem;
}

.shared-workspace-menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 9px;
  cursor: pointer;
}

.shared-workspace-menu-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.shared-workspace-menu-row strong,
.shared-workspace-menu-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-workspace-menu-row strong {
  font-size: 0.76rem;
}

.shared-workspace-menu-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
}

.folder-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 0;
  align-items: center;
}

.btn-create-folder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 8px;
  background: rgba(31, 111, 235, 0.14);
  color: #79c0ff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-create-folder-icon {
  display: block;
  flex: 0 0 auto;
}

.btn-create-folder:hover {
  background: rgba(31, 111, 235, 0.24);
  border-color: rgba(88, 166, 255, 0.55);
}

.btn-create-folder:active {
  transform: scale(0.96);
}

.folder-name-input {
  min-height: 36px;
  padding: 8px 10px;
  background: #161b22;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.82rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.folder-name-input::placeholder {
  color: var(--muted);
}

.folder-name-input:focus {
  outline: none;
  border-color: rgba(88, 166, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.18);
}

.folder-zone {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  overflow: hidden;
}

.folder-group-label {
  margin: 6px 2px 8px;
  padding: 0;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6e7681;
  line-height: 1;
}

.folder-group-label + .folder-zone {
  margin-top: 0;
}

/* Quiet breath before the public shelf — one hairline, nothing louder. */
.folder-group-label--break {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(110, 118, 129, 0.28);
}

.folder-zone.drop-target-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 139, 253, 0.35);
}

.project-list .proj-item.drop-before {
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.project-list .proj-item.drop-after {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.folder-zone-root {
  border-style: dashed;
}

.folder-zone-root--shared {
  border-color: rgba(251, 133, 0, 0.5);
  background:
    radial-gradient(circle at 0% 0%, rgba(251, 133, 0, 0.1), transparent 38%),
    rgba(13, 17, 23, 0.78);
  box-shadow: 0 0 0 1px rgba(251, 133, 0, 0.12) inset;
}

.folder-zone-root--shared .folder-header {
  background: linear-gradient(90deg, rgba(251, 133, 0, 0.18), rgba(13, 17, 23, 0));
}

.folder-workspace-highlight {
  flex-shrink: 0;
  padding: 2px 7px;
  border: 1px solid rgba(251, 133, 0, 0.42);
  border-radius: 999px;
  background: rgba(251, 133, 0, 0.16);
  color: #ffa657;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-select--shared {
  border-color: rgba(251, 133, 0, 0.55) !important;
  box-shadow: 0 0 0 1px rgba(251, 133, 0, 0.18);
}

.new-project-workspace-card {
  width: min(520px, calc(100vw - 32px));
}

.new-project-workspace-copy {
  margin: 0 0 14px;
  line-height: 1.5;
}

.new-project-workspace-options {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.new-project-workspace-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(13, 17, 23, 0.92);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.new-project-workspace-option:hover,
.new-project-workspace-option:focus-visible {
  border-color: rgba(88, 166, 255, 0.58);
  outline: none;
}

.new-project-workspace-option--shared {
  border-color: rgba(251, 133, 0, 0.38);
  background:
    radial-gradient(circle at 0% 0%, rgba(251, 133, 0, 0.12), transparent 42%),
    rgba(13, 17, 23, 0.92);
}

.new-project-workspace-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(88, 166, 255, 0.12);
  font-size: 1.1rem;
}

.new-project-workspace-option--shared .new-project-workspace-icon {
  background: rgba(251, 133, 0, 0.16);
}

.new-project-workspace-option strong,
.new-project-workspace-option small {
  display: block;
}

.new-project-workspace-option small {
  margin-top: 2px;
  color: var(--muted);
}

.new-project-workspace-remember {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #161b22;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: context-menu;
}

.folder-zone-collapsed .folder-header {
  border-bottom: none;
}

.folder-collapse-btn {
  border: none;
  background: transparent;
  color: #8b949e;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.72rem;
  line-height: 1;
  flex-shrink: 0;
}

.folder-collapse-btn:hover {
  color: var(--text);
}

.folder-title-toggle {
  cursor: pointer;
}

.folder-zone-collapsed .project-list {
  display: none;
}

.proj-item--loading .proj-row-body {
  color: var(--accent);
}

.proj-loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(88, 166, 255, 0.22);
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: proj-loading-spin 0.75s linear infinite;
  flex-shrink: 0;
}

.proj-gen-user {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.proj-gen-avatar,
.proj-gen-avatar--image {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.18);
  color: #79c0ff;
  font-size: 0.62rem;
  font-weight: 800;
  background-size: cover !important;
  background-position: center !important;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.28);
}

.proj-gen-avatar--image {
  color: transparent;
}

.proj-gen-user--rigging .proj-gen-avatar {
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
}

.proj-gen-user--prompt .proj-gen-avatar,
.proj-gen-user--render .proj-gen-avatar {
  background: rgba(163, 113, 247, 0.2);
  color: #d2a8ff;
  box-shadow: 0 0 0 2px rgba(163, 113, 247, 0.42);
  animation: proj-prompt-pulse 1.6s ease-in-out infinite;
}

.proj-gen-user--v2 .proj-gen-avatar {
  background: rgba(210, 153, 34, 0.2);
  color: #f2cc60;
  box-shadow: 0 0 0 2px rgba(210, 153, 34, 0.42);
  animation: proj-v2-pulse 1.6s ease-in-out infinite;
}

.proj-loading-spinner--prompt,
.proj-loading-spinner--render {
  border-color: rgba(163, 113, 247, 0.22);
  border-top-color: #a371f7;
}

.proj-loading-spinner--v2 {
  border-color: rgba(210, 153, 34, 0.22);
  border-top-color: #d29922;
}

.proj-gen-user--prompt .proj-gen-ai,
.proj-gen-user--render .proj-gen-ai {
  background: rgba(163, 113, 247, 0.2);
  color: #d2a8ff;
}

.proj-gen-user--v2 .proj-gen-ai {
  background: rgba(210, 153, 34, 0.2);
  color: #f2cc60;
}

.proj-gen-progress--render {
  border-color: rgba(163, 113, 247, 0.42);
  background: rgba(163, 113, 247, 0.14);
  color: #d2a8ff;
}

.proj-gen-progress--v2 {
  border-color: rgba(210, 153, 34, 0.42);
  background: rgba(210, 153, 34, 0.14);
  color: #f2cc60;
}

.proj-gen-progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 1px 6px;
  border: 1px solid rgba(88, 166, 255, 0.42);
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.14);
  color: #79c0ff;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.25;
  flex-shrink: 0;
}

.proj-loading-label--prompt,
.proj-loading-label--render {
  color: #c297ff;
}

.proj-loading-label--v2 {
  color: #f2cc60;
}

.proj-item--prompt-gen .proj-row-body,
.proj-item--render-gen .proj-row-body {
  color: #c297ff;
}

.project-list .proj-item--prompt-gen .proj-row-body,
.project-list .proj-item--render-gen .proj-row-body {
  border-left: 3px solid #a371f7 !important;
  padding-left: 5px;
}

.project-list li.proj-item--prompt-gen,
.project-list li.proj-item--render-gen {
  background: rgba(163, 113, 247, 0.07);
}

.proj-item--v2-gen .proj-row-body {
  color: #f2cc60;
}

.project-list .proj-item--v2-gen .proj-row-body {
  border-left: 3px solid #d29922 !important;
  padding-left: 5px;
}

.project-list li.proj-item--v2-gen {
  background: rgba(210, 153, 34, 0.07);
}

@keyframes proj-prompt-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(163, 113, 247, 0.42); }
  50%       { box-shadow: 0 0 0 5px rgba(163, 113, 247, 0.16); }
}

@keyframes proj-v2-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(210, 153, 34, 0.42); }
  50%       { box-shadow: 0 0 0 5px rgba(210, 153, 34, 0.16); }
}

.proj-gen-rig-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.16);
  color: #fb923c;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.22);
}

.proj-gen-rig-icon svg {
  width: 13px;
  height: 13px;
}

.proj-gen-ai {
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.16);
  color: #79c0ff;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.proj-gen-user--rigging .proj-gen-ai {
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
}

.proj-loading-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #58a6ff;
  letter-spacing: 0.02em;
}

.proj-loading-label--rigging {
  color: #fb923c;
}

/* ── New-model badge dot ── */
.proj-new-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3fb950;
  color: #0d1117;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(63, 185, 80, 0.4);
  animation: proj-new-pulse 2s ease-in-out infinite;
}

@keyframes proj-new-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(63, 185, 80, 0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(63, 185, 80, 0.15); }
}

.project-list .proj-item--new .proj-row-body {
  border-left: 3px solid #3fb950 !important;
  padding-left: 5px;
}

.project-list li.proj-item--new {
  background: rgba(63, 185, 80, 0.06);
}

.proj-hierarchy-loading,
.design-browser-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.72rem;
  color: var(--muted);
}

.proj-hierarchy-loading {
  margin: 2px 0 4px 28px;
  border-left: 2px solid rgba(88, 166, 255, 0.35);
  padding-left: 10px;
}

.design-browser-loading {
  justify-content: center;
  min-height: 100px;
  color: #8b949e;
}

@keyframes proj-loading-spin {
  to { transform: rotate(360deg); }
}

.proj-item {
  flex-direction: column;
  align-items: stretch;
}

.proj-item-main {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
}

.proj-expand-btn {
  border: none;
  background: transparent;
  color: #8b949e;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.72rem;
  line-height: 1;
  align-self: center;
  flex-shrink: 0;
  width: 14px;
}

.proj-expand-btn:hover {
  color: var(--text);
}

.proj-expand-btn-spacer {
  opacity: 0;
  cursor: default;
}

.proj-hierarchy {
  margin: 0 4px 6px 22px;
  padding: 4px 0 2px;
  border-left: 1px solid #30363d;
}

.proj-hierarchy-section-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  border: none;
  background: transparent;
  color: #8b949e;
  font-size: 0.72rem;
  cursor: pointer;
  text-align: left;
}

.proj-hierarchy-section-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.proj-hierarchy-section-label {
  font-weight: 600;
  color: #c9d1d9;
}

.proj-hierarchy-section-count {
  margin-left: auto;
  font-size: 0.65rem;
}

.proj-hierarchy-list {
  list-style: none;
  margin: 0;
  padding: 0 0 2px 12px;
}

.proj-hierarchy-bodies {
  list-style: none;
  margin: 0;
  padding: 0;
}

.proj-hierarchy-bodies-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 10px);
  margin: 2px 0 2px 18px;
  padding: 3px 6px;
  border: none;
  background: transparent;
  color: #8b949e;
  font-size: 0.7rem;
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
}

.proj-hierarchy-bodies-toggle .browser-chevron {
  width: 10px;
  flex: 0 0 auto;
  opacity: 0.9;
}

.proj-hierarchy-bodies-toggle:hover {
  background: rgba(33, 38, 45, 0.85);
  color: #c9d1d9;
}

.proj-hierarchy-list--bodies {
  padding-left: 10px;
  margin: 0;
}

.proj-hierarchy-item--body {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding-left: 4px;
}

.proj-hierarchy-item--body .proj-hierarchy-item-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 2px;
}

.proj-hierarchy-item--body .proj-hierarchy-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

.proj-hierarchy-body-icon {
  font-size: 0.5rem;
  color: #8b949e;
  flex: 0 0 auto;
  margin-right: 2px;
}

.proj-hierarchy-item-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  color: #c9d1d9;
  text-align: left;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
}

.proj-hierarchy-item-btn:hover {
  background: #21262d;
}

.proj-hierarchy-item--selected .proj-hierarchy-item-btn {
  background: rgba(31, 111, 235, 0.2);
  outline: 1px solid rgba(88, 166, 255, 0.65);
  color: #e6f1ff;
}

.proj-hierarchy-item--hidden .proj-hierarchy-item-btn {
  color: #7d8590;
}

.proj-hierarchy-item--hidden .proj-hierarchy-item-name {
  opacity: 0.58;
}

.proj-hierarchy-hidden-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #8b949e;
}

.proj-hierarchy-vis-btn {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #8b949e;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.proj-hierarchy-vis-btn:hover {
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.12);
}

.proj-hierarchy-vis-btn.is-hidden {
  color: #6e7681;
  opacity: 0.85;
}

.proj-hierarchy-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-hierarchy-edit-hint {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s;
  cursor: pointer;
}

.proj-hierarchy-item-btn:hover .proj-hierarchy-edit-hint {
  opacity: 0.6;
}

.proj-hierarchy-item-btn:hover .proj-hierarchy-edit-hint:hover {
  opacity: 1;
  color: #58a6ff;
}

.proj-hierarchy-empty {
  padding: 2px 6px 4px 18px;
  list-style: none;
}

.folder-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.folder-title {
  flex: 1 1 auto;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-count {
  font-size: 0.7rem;
  flex-shrink: 0;
}

.btn-folder-menu {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
}

.btn-folder-menu:hover {
  color: var(--text);
  background: #21262d;
}

.btn-folder-new-project:hover,
.btn-folder-edit:hover {
  color: var(--accent);
}

.folder-edit-card {
  width: min(520px, calc(100vw - 32px));
  max-height: min(84vh, 720px);
  overflow: auto;
}

.folder-edit-hint {
  margin: 0 0 12px;
}

.folder-edit-projects-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 8px;
  font-size: 0.85rem;
}

.folder-edit-project-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.folder-edit-empty {
  padding: 12px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.folder-edit-project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.folder-edit-project-name {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel, #0d1117);
  color: inherit;
  font-size: 0.85rem;
}

.folder-edit-project-actions {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

.folder-drop-hint {
  padding: 12px 10px !important;
  cursor: default;
  list-style: none;
}

.proj-item.dragging {
  opacity: 0.45;
}

.proj-drag-handle {
  color: var(--muted);
  margin-right: 4px;
  font-size: 0.75rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.browser-empty {
  padding: 8px 0;
}

.project-list,
.file-list {
  list-style: none;
}

.project-list .proj-item {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.project-list li,
.project-list .proj-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.project-list li:hover { background: #21262d; }
.project-list li.active {
  border-color: var(--accent2);
  background: #23863618;
}

.project-list .proj-item .proj-row-body {
  flex: 1;
  min-width: 0;
}

.project-list .proj-row-body {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.project-list .proj-row-body:hover {
  background: rgba(255, 255, 255, 0.04);
}

.project-current-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.project-current-row #project-id {
  flex: 1;
  min-width: 0;
  margin: 0;
  word-break: break-word;
}

.btn-compact {
  padding: 4px 10px;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.project-list .proj-row-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-self: center;
}

.btn-proj-rename,
.btn-proj-delete {
  padding: 4px 8px;
  font-size: 0.68rem;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.btn-proj-rename:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #1f6feb22;
}

.btn-proj-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #ff7b7218;
}

.project-list .proj-name {
  display: block;
  font-weight: 500;
  color: var(--text);
}

.project-list .proj-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

.project-list .proj-owner-badge {
  display: inline-block;
  margin: 3px 0 0 0;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.12);
  color: #9ecbff;
  font-size: 0.65rem;
  line-height: 1.25;
}

.proj-id-badge,
.proj-hierarchy-item-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.62rem;
  color: var(--muted);
  opacity: 0.9;
}

.proj-id-badge {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}

.proj-hierarchy-item-id {
  flex-shrink: 0;
  margin-left: 4px;
  opacity: 0.75;
}

.file-list {
  list-style: none;
}

.file-list .file-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.file-list .file-item:hover { background: #21262d; }
.file-list .file-item.active {
  border-color: var(--accent);
  background: #1f6feb18;
}

.file-item-body {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
  align-self: center;
}

.btn-file-export,
.btn-file-rename,
.btn-file-delete,
.btn-proj-export {
  padding: 3px 7px;
  font-size: 0.64rem;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.btn-file-export:hover,
.btn-proj-export:hover {
  border-color: #4a6b3f;
  color: #bfe7a8;
  background: #2a3d2218;
}

.btn-file-rename:hover,
.btn-proj-rename:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #1f6feb22;
}

.btn-file-delete:hover,
.btn-proj-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #ff7b7218;
}

.file-export-menu {
  z-index: 1200;
  box-sizing: border-box;
  width: min(340px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(88, 166, 255, 0.18);
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.96));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow-x: hidden;
  position: relative;
}

.file-export-menu:has(.file-export-fusion-picker) {
  width: min(420px, calc(100vw - 16px));
}

.file-export-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.file-export-title {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  word-break: break-all;
  padding-right: 4px;
}

.file-export-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: -2px -4px 0 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #8b949e;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-export-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f0f3f6;
}

.file-export-hint {
  margin: 0 0 8px;
  line-height: 1.35;
}

.file-export-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.file-export-dl {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid #34405c;
  background: #1c2638;
  color: #cfe0ff;
  cursor: pointer;
}

.file-export-dl:hover { background: #26324a; }
.file-export-dl:disabled,
.file-export-dl.is-preparing {
  opacity: 0.55;
  cursor: wait;
  color: #8b949e;
  border-color: #30363d;
  background: #161b22;
  filter: grayscale(0.35);
  pointer-events: none;
}
.file-export-dl.is-preparing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.file-export-spinner {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 2px solid rgba(139, 148, 158, 0.35);
  border-top-color: #8b949e;
  flex: 0 0 auto;
  animation: file-export-spin 0.8s linear infinite;
}
.file-export-bambu.is-preparing,
.file-export-onshape.is-preparing,
.file-export-fusion-action.is-preparing {
  opacity: 0.55;
  cursor: wait;
  filter: grayscale(0.4);
}
.file-export-dl[data-current="true"] {
  border-color: #58a6ff;
  color: #d8ebff;
  background: #18314d;
}
.file-export-dl[data-base="true"] {
  opacity: 0.72;
}
.file-export-dl[data-fmt="step"] { border-color: #4a6b3f; color: #bfe7a8; }
.file-export-dl[data-fmt="stl"] { border-color: #6b5a3f; color: #e7d2a8; }
.file-export-dl[data-fmt="3mf"] { border-color: #5a4a6b; color: #d4c0f0; }

.file-export-step-chooser {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 8px;
  padding: 8px;
  position: relative;
  border: 1px solid rgba(74, 107, 63, 0.55);
  border-radius: 9px;
  background: rgba(42, 61, 34, 0.22);
}

.file-export-step-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #bfe7a8;
}

.file-export-step-choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid #34405c;
  background: #101822;
  color: var(--text);
  cursor: pointer;
}

.file-export-step-choice:hover {
  border-color: #4a6b3f;
  background: #1c2a1a;
}

.file-export-step-choice:disabled {
  opacity: 0.62;
  cursor: wait;
}

.file-export-step-choice span {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.25;
}

.file-export-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-export-share {
  width: 100%;
}

.file-export-share:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.file-export-share.is-loading {
  position: relative;
  color: #d7e7ff;
  cursor: wait;
  opacity: 0.68;
}

.file-export-share.is-loading::before {
  content: "";
  width: 13px;
  height: 13px;
  margin-right: 7px;
  border-radius: 999px;
  border: 2px solid rgba(215, 231, 255, 0.34);
  border-top-color: #58a6ff;
  display: inline-block;
  vertical-align: -2px;
  animation: file-export-spin 0.8s linear infinite;
}

.file-export-error-card,
.file-export-success-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.file-export-error-card {
  border: 1px solid rgba(255, 123, 114, 0.32);
  background:
    radial-gradient(circle at top left, rgba(255, 123, 114, 0.18), transparent 42%),
    rgba(82, 20, 18, 0.22);
}

.file-export-error-card--fusion {
  border-color: rgba(241, 138, 43, 0.38);
  background:
    radial-gradient(circle at top left, rgba(241, 138, 43, 0.2), transparent 42%),
    rgba(88, 49, 11, 0.18);
}

.file-export-error-card--auth {
  border-color: rgba(88, 166, 255, 0.38);
  background:
    radial-gradient(circle at top left, rgba(88, 166, 255, 0.2), transparent 42%),
    rgba(20, 47, 82, 0.18);
}

.file-export-success-card {
  border: 1px solid rgba(63, 185, 80, 0.35);
  background:
    radial-gradient(circle at top left, rgba(63, 185, 80, 0.16), transparent 42%),
    rgba(22, 80, 38, 0.18);
}

.file-export-error-icon,
.file-export-success-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 900;
}

.file-export-error-icon {
  background: rgba(255, 123, 114, 0.16);
  color: #ffb4ad;
}

.file-export-error-card--fusion .file-export-error-icon {
  background: rgba(241, 138, 43, 0.18);
  color: #ffd0a3;
}

.file-export-error-card--auth .file-export-error-icon {
  background: rgba(88, 166, 255, 0.18);
  color: #b8dcff;
}

.file-export-success-icon {
  background: rgba(63, 185, 80, 0.16);
  color: #9be9a8;
}

.file-export-error-body strong,
.file-export-success-card strong {
  display: block;
  color: #f0f6fc;
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.file-export-error-body p,
.file-export-success-card p {
  margin: 0;
  color: #c9d1d9;
  font-size: 0.72rem;
  line-height: 1.35;
}

.file-export-error-body small {
  display: block;
  margin-top: 5px;
  color: #8b949e;
  font-size: 0.66rem;
  line-height: 1.3;
  word-break: break-word;
}

.file-export-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.file-export-onshape {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid #8b2020;
  background: rgba(232, 35, 42, 0.12);
  color: #ff8080;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.file-export-onshape:hover:not(:disabled) {
  background: rgba(232, 35, 42, 0.22);
  border-color: #e8232a;
  color: #ffaaaa;
}
.file-export-onshape:disabled {
  opacity: 0.6;
  cursor: default;
}

.file-export-fusion {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(241, 138, 43, 0.45);
  background: rgba(241, 138, 43, 0.09);
  color: #ffd0a3;
  font-size: 0.74rem;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}
.file-export-fusion:hover:not(:disabled) {
  background: rgba(241, 138, 43, 0.18);
  border-color: #f18a2b;
  color: #ffe3c7;
}
.file-export-fusion:disabled {
  opacity: 0.6;
  cursor: default;
}

/* BAMBU-STUDIO-EXPORT */
.file-export-bambu {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid rgba(0, 174, 239, 0.45);
  background: rgba(0, 174, 239, 0.12);
  color: #7ad7ff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.file-export-bambu:hover:not(:disabled) {
  background: rgba(0, 174, 239, 0.2);
  border-color: rgba(0, 174, 239, 0.75);
  color: #b6ecff;
}

.file-export-bambu:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.file-export-bambu-mark {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #00aeef;
  color: #041018;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.file-export-bambu-followup {
  margin-top: 6px;
  padding: 8px 9px;
  border: 1px solid rgba(0, 174, 239, 0.28);
  border-radius: 8px;
  background: rgba(0, 174, 239, 0.08);
}

.file-export-bambu-followup p {
  margin: 0 0 6px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #c9d1d9;
}

.file-export-bambu-followup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.file-export-fusion-picker {
  margin-top: 8px;
  padding: 9px;
  position: relative;
  border: 1px solid rgba(241, 138, 43, 0.24);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.72);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.file-export-fusion-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffd0a3;
  margin-bottom: 4px;
  padding-right: 22px;
}

.file-export-fusion-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #8b949e;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.file-export-fusion-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f0f3f6;
}

.file-export-step-title {
  padding-right: 22px;
}

.file-export-cloud-field {
  display: grid;
  gap: 3px;
  margin: 7px 0;
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 0;
  max-width: 100%;
}

.file-export-cloud-field select,
.file-export-cloud-field input[type="search"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.72rem;
}

.file-export-fusion-project-tools {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.file-export-fusion-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 168px;
  overflow: auto;
  margin-top: 6px;
  padding: 2px;
  min-width: 0;
}

.file-export-fusion-project-card {
  position: relative;
  display: grid;
  gap: 2px;
  align-content: start;
  text-align: left;
  min-width: 0;
  padding: 8px 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-export-fusion-project-card:hover {
  border-color: rgba(241, 138, 43, 0.45);
  background: rgba(241, 138, 43, 0.08);
}

.file-export-fusion-project-card.is-active {
  border-color: rgba(241, 138, 43, 0.7);
  background: rgba(241, 138, 43, 0.14);
  box-shadow: inset 0 0 0 1px rgba(241, 138, 43, 0.25);
}

.file-export-fusion-project-card strong {
  font-size: 0.7rem;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-export-fusion-project-card > span {
  font-size: 0.62rem;
  color: var(--muted);
}

.file-export-fusion-pill {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1a1208;
  background: #f18a2b;
}

.file-export-fusion-folder-browser {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.file-export-fusion-folder-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 6px;
}

.file-export-fusion-folder-head > span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-export-fusion-folder-list,
.file-export-fusion-folder-grid {
  display: grid;
  gap: 6px;
  max-height: 200px;
  overflow: auto;
  min-width: 0;
}

.file-export-fusion-folder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.file-export-fusion-folder-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.file-export-fusion-folder-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.file-export-fusion-folder-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.file-export-fusion-folder-card.is-active {
  border-color: rgba(241, 138, 43, 0.55);
  background: rgba(241, 138, 43, 0.1);
}

.file-export-fusion-folder-card-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.file-export-fusion-folder-card-body strong {
  font-size: 0.72rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-export-fusion-folder-card-body span {
  font-size: 0.62rem;
  color: var(--muted);
}

.file-export-fusion-folder-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.file-export-fusion-use-current {
  width: 100%;
  margin-bottom: 6px;
}

.file-export-fusion-submit {
  width: 100%;
  margin-top: 4px;
}

.file-export-fusion-submit.file-export-fusion-submit--success,
.file-export-fusion-submit--success {
  background: #238636 !important;
  border-color: #2ea043 !important;
  color: #fff !important;
  cursor: default;
}

.file-export-fusion-status {
  margin-top: 6px;
  line-height: 1.35;
}

.file-export-inline-error {
  display: grid;
  gap: 4px;
  margin-top: 2px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 123, 114, 0.3);
  background: rgba(82, 20, 18, 0.22);
  color: #ffb4ad;
  line-height: 1.35;
}

.file-export-inline-error--fusion {
  border-color: rgba(241, 138, 43, 0.38);
  background: rgba(88, 49, 11, 0.2);
  color: #ffd0a3;
}

.file-export-inline-error--auth {
  border-color: rgba(88, 166, 255, 0.38);
  background: rgba(20, 47, 82, 0.18);
  color: #b8dcff;
}

.file-export-inline-error strong {
  color: inherit;
  font-size: 0.75rem;
}

.file-export-inline-error span,
.file-export-inline-error small {
  color: #c9d1d9;
}

.file-export-inline-error small {
  color: #8b949e;
  word-break: break-word;
}

@keyframes file-export-spin {
  to { transform: rotate(360deg); }
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
}

kbd {
  font-family: var(--mono);
  font-size: 0.68rem;
  background: #21262d;
  border: 1px solid var(--border);
  padding: 2px 5px;
  border-radius: 4px;
}

textarea, input[type="number"] {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.82rem;
}

textarea { resize: vertical; min-height: 90px; }

label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

label input { margin-top: 4px; }

.prompt-panel {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.prompt-panel.right-tab-panel.active {
  display: flex;
  flex-direction: column;
}

.prompt-panel-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  flex-shrink: 0;
}

.prompt-tab {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.78rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.prompt-tab:hover {
  background: #21262d;
  color: var(--text);
}

.prompt-tab.active {
  border-color: var(--border);
  background: #21262d;
  color: var(--text);
}

.project-cost-thumb {
  margin: 8px 0 8px;
  padding: 10px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(88, 166, 255, 0.14), transparent 42%),
    rgba(255, 255, 255, 0.03);
}

.project-cost-thumb.hidden {
  display: none;
}

.project-cost-thumb-head,
.project-cost-thumb-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.project-cost-thumb-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-cost-thumb-head strong {
  font-size: 1.1rem;
  color: #e6f1ff;
  font-variant-numeric: tabular-nums;
}

.project-cost-thumb-chart {
  height: 54px;
  margin: 10px 0 8px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 6px 4px;
  border: 1px solid rgba(48, 54, 61, 0.55);
  border-radius: 10px;
  background:
    linear-gradient(to top, rgba(139, 148, 158, 0.13) 1px, transparent 1px) 0 0 / 100% 25%,
    rgba(13, 17, 23, 0.72);
}

.project-cost-thumb-chart i {
  flex: 1;
  min-width: 4px;
  max-width: 16px;
  border-radius: 999px 999px 3px 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  opacity: 0.92;
}

.project-cost-thumb.is-empty .project-cost-thumb-chart i {
  background: rgba(139, 148, 158, 0.35);
}

.project-cost-thumb-meta {
  color: var(--muted);
  font-size: 0.72rem;
  flex-wrap: wrap;
  row-gap: 4px;
}

.prompt-pane.hidden {
  display: none;
}

#prompt-pane-compose.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#wiring-prompt-pane-compose.active,
#rigging-prompt-pane-compose.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#prompt-pane-history.active,
#wiring-prompt-pane-history.active,
#rigging-prompt-pane-history.active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#prompt-pane-history.active > p,
#wiring-prompt-pane-history.active > p,
#rigging-prompt-pane-history.active > p,
#prompt-pane-history.active .prompt-history-summary,
#wiring-prompt-pane-history.active .prompt-history-summary,
#rigging-prompt-pane-history.active .prompt-history-summary {
  flex-shrink: 0;
}

#prompt-input,
#wiring-prompt-input,
#rigging-prompt-input,
#sketch-prompt-input {
  flex: 1 1 auto;
  width: 100%;
  box-sizing: border-box;
  min-height: clamp(148px, 26vh, 240px);
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.45;
}

#prompt-input {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
}

.prompt-input-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.prompt-input-head .sketch-prompt-title {
  margin: 0;
}

.prompt-input-head-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prompt-mic-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.prompt-skills-row .prompt-mic-btn {
  margin-left: 2px;
}

.prompt-mic-icon {
  font-size: 0.95rem;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-style: normal;
  display: block;
  transform: scale(0.9);
}

.prompt-mic-btn:hover {
  color: var(--text);
  background: rgba(88, 166, 255, 0.12);
}

.prompt-mic-btn.mic-active {
  color: #ff7b72;
  background: rgba(248, 81, 73, 0.14);
}

.prompt-mic-btn.mic-active .prompt-mic-icon {
  animation: prompt-mic-pulse 1.1s ease-in-out infinite;
}

@keyframes prompt-mic-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.prompt-pane h2 {
  margin: 0;
}

.prompt-compose-toolbar {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(48, 54, 61, 0.75);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

.prompt-compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.45);
  min-width: 0;
}

.prompt-compose-head h2 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Hidden legacy select (kept for JS compat) ── */
.prompt-ai-key-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ── Key picker pill button ── */
.prompt-key-picker-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

.prompt-key-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 7px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.85);
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  max-width: 180px;
  min-width: 0;
  transition: border-color 0.15s, background 0.15s;
}
.prompt-key-pill:hover {
  border-color: rgba(88, 166, 255, 0.5);
  background: rgba(22, 27, 34, 0.95);
}
.prompt-key-pill[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}
.prompt-key-pill-kw {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}
.prompt-key-pill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}
.prompt-key-pill-model {
  font-size: 0.63rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prompt-key-pill-arrow {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s;
}
.prompt-key-pill[aria-expanded="true"] .prompt-key-pill-arrow {
  transform: rotate(180deg);
}

/* ── Key picker popup ── */
.prompt-key-popup {
  position: fixed;
  z-index: 9999;
  width: 296px;
  max-height: 480px;
  overflow-y: auto;
  background: #161b22;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  padding: 6px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.prompt-key-popup.hidden { display: none; }

.prompt-key-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 6px 14px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.7);
  margin-bottom: 4px;
}
.prompt-key-popup-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.prompt-key-popup-manage {
  font-size: 0.7rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.prompt-key-popup-manage:hover { text-decoration: underline; }

.prompt-key-popup-section {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px 2px;
}

.prompt-key-popup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 14px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s;
  position: relative;
}
.prompt-key-popup-row:hover { background: rgba(48, 54, 61, 0.45); }
.prompt-key-popup-row.active { background: rgba(88, 166, 255, 0.1); }

.prompt-key-popup-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(88, 166, 255, 0.45);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s, background 0.12s;
}
.prompt-key-popup-row.active .prompt-key-popup-check {
  background: var(--accent);
  border-color: var(--accent);
}
.prompt-key-popup-check-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transition: opacity 0.1s;
}
.prompt-key-popup-row.active .prompt-key-popup-check-dot { opacity: 1; }

.prompt-key-popup-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.prompt-key-popup-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.prompt-key-popup-row.active .prompt-key-popup-name {
  color: #e6edf3;
}
.prompt-key-popup-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}
.prompt-key-popup-badge.badge-openai {
  background: rgba(16, 163, 127, 0.18);
  color: #10a37f;
}
.prompt-key-popup-badge.badge-claude {
  background: rgba(205, 143, 80, 0.18);
  color: #cd8f50;
}

.prompt-key-popup-model-wrap {
  flex-shrink: 0;
}
.prompt-key-popup-model-select {
  font-size: 0.68rem;
  padding: 3px 6px;
  background: rgba(22, 27, 34, 0.9);
  border: 1px solid rgba(48, 54, 61, 0.8);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  max-width: 110px;
}
.prompt-key-popup-model-select:focus {
  outline: none;
  border-color: var(--accent);
}

.prompt-key-popup-empty {
  font-size: 0.74rem;
  color: var(--muted);
  padding: 10px 14px;
  font-style: italic;
}

.prompt-mode-row {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  flex-shrink: 0;
  overflow: visible;
}

.prompt-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  min-width: 0;
}

#prompt-pane-compose,
#prompt-pane-compose .prompt-mode-row,
.prompt-panel:has(.prompt-mode-row),
.right-tab-panel:has(.prompt-mode-row),
.sidebar.right:has(.prompt-mode-row) {
  overflow: visible;
}

.prompt-mode-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #0d1117;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.prompt-mode-wrap {
  position: relative;
  display: inline-flex;
}

.prompt-mode-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 500;
  width: min(250px, 72vw);
  transform: translateX(-50%) translateY(4px);
  pointer-events: none;
  opacity: 0;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  color: #c9d1d9;
  padding: 9px 10px;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: normal;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.prompt-mode-wrap:hover .prompt-mode-tip,
.prompt-mode-wrap:focus-within .prompt-mode-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.prompt-mode-btn.active {
  border-color: var(--accent);
  color: #e6f1ff;
  background: rgba(88, 166, 255, 0.18);
}

.prompt-mode-btn--v2 {
  letter-spacing: 0.04em;
}

.prompt-mode-btn--v2:hover:not(.active) {
  border-color: #8b6914;
  color: #c9a227;
  background: rgba(212, 160, 23, 0.06);
}

.prompt-mode-btn--v2.active {
  border-color: #d4a017;
  color: #f0c040;
  background: rgba(212, 160, 23, 0.22);
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.35);
}

/* Compose pane — prompt area scrolls when image thumbnails are attached */
#prompt-pane-compose #prompt-input {
  flex: 0 1 auto;
  min-height: clamp(84px, 15vh, 145px);
  height: auto;
  max-height: min(170px, 24vh);
  margin-bottom: 2px;
  resize: vertical;
}

#prompt-pane-compose:has(.prompt-image-list:not(:empty)) #prompt-input {
  min-height: 72px;
  max-height: 118px;
}

#prompt-pane-compose .prompt-compose-toolbar,
#prompt-pane-compose .prompt-skills-row,
#prompt-pane-compose .prompt-inline-ref-chips,
#prompt-pane-compose .prompt-image-drop,
#prompt-pane-compose .prompt-image-list,
#prompt-pane-compose #btn-prompt,
#prompt-pane-compose #btn-stop-generation,
#prompt-pane-compose #prompt-status,
#prompt-pane-compose #prompt-reply {
  flex-shrink: 0;
}

#prompt-pane-compose .prompt-editor-wrap {
  flex: 1 1 auto;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#prompt-pane-compose .prompt-editor {
  flex: 1 1 auto;
  min-height: 110px;
  max-height: none;
}

#prompt-pane-compose .prompt-inline-ref-chips {
  max-height: 64px;
}

#prompt-pane-compose .prompt-compose-toolbar {
  margin-bottom: 4px;
  padding: 4px 6px;
  gap: 4px;
}

#prompt-pane-compose .prompt-compose-head {
  padding-bottom: 4px;
}

#prompt-pane-compose #prompt-mode-hint {
  font-size: 0.66rem;
  line-height: 1.2;
  margin-top: 0;
}

#prompt-pane-compose .prompt-target-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  padding: 4px;
  border: 1px solid rgba(88, 166, 255, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.09), rgba(163, 113, 247, 0.05)),
    rgba(13, 17, 23, 0.58);
  min-width: 0;
}

#prompt-pane-compose .prompt-target-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#prompt-target-mode,
#prompt-target-object {
  min-width: 0;
  flex: 0 0 auto;
  height: 28px;
  padding: 3px 28px 3px 10px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(56, 139, 253, 0.22), rgba(56, 139, 253, 0.08)),
    #0d1117;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 0 1px rgba(0,0,0,0.16);
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #8b949e 50%),
    linear-gradient(135deg, #8b949e 50%, transparent 50%),
    linear-gradient(180deg, rgba(56, 139, 253, 0.22), rgba(56, 139, 253, 0.08));
  background-position:
    calc(100% - 14px) 11px,
    calc(100% - 9px) 11px,
    0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%;
  background-repeat: no-repeat;
}

#prompt-target-object {
  flex: 1 1 auto;
  max-width: 150px;
}

.prompt-target-picker-btn {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 10px 5px 6px;
  border: 1px solid rgba(88, 166, 255, 0.38);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.18), rgba(163, 113, 247, 0.08)),
    rgba(13, 17, 23, 0.92);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 8px 22px rgba(0,0,0,0.18);
}

.prompt-target-picker-btn:hover,
.prompt-target-picker-btn[aria-expanded="true"] {
  border-color: rgba(88, 166, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.14), inset 0 1px 0 rgba(255,255,255,0.08);
}

.prompt-target-picker-thumb,
.prompt-target-card-thumb {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.9);
}

.prompt-target-picker-thumb {
  width: 54px;
  height: 42px;
}

.prompt-target-picker-thumb canvas {
  transform: scale(0.78);
}

.prompt-target-picker-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}

.prompt-target-picker-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 800;
}

.prompt-target-picker-subtitle {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
}

.prompt-target-picker-arrow {
  flex: 0 0 auto;
  color: var(--muted);
  margin-left: auto;
}

.prompt-target-popup {
  position: fixed;
  z-index: 10020;
  max-height: min(520px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98)),
    var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.prompt-target-popup.hidden {
  display: none;
}

.prompt-target-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.72);
}

.prompt-target-popup-header strong {
  display: block;
  font-size: 0.84rem;
}

.prompt-target-popup-header span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.prompt-target-popup-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(22, 27, 34, 0.92);
  color: var(--muted);
  cursor: pointer;
}

.prompt-target-popup-close:hover {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.65);
}

.prompt-target-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 10px 0;
  padding: 7px 9px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 11px;
  background: rgba(1, 4, 9, 0.34);
}

.prompt-target-search span {
  color: var(--muted);
  font-size: 0.78rem;
}

.prompt-target-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.76rem;
}

.prompt-target-search-clear {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(139, 148, 158, 0.14);
  color: var(--muted);
  cursor: pointer;
}

.prompt-target-popup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
}

.prompt-target-card {
  width: 100%;
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 14px;
  background: rgba(22, 27, 34, 0.74);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.prompt-target-card:hover {
  border-color: rgba(88, 166, 255, 0.62);
  background: rgba(56, 139, 253, 0.10);
}

.prompt-target-card.previewing {
  border-color: rgba(63, 185, 80, 0.82);
  background: rgba(46, 160, 67, 0.13);
  box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.12);
}

.prompt-target-card.active {
  border-color: rgba(88, 166, 255, 0.9);
  background: rgba(56, 139, 253, 0.16);
}

.prompt-target-card-thumb {
  width: 68px;
  height: 52px;
}

.prompt-target-card-info {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prompt-target-card-info strong,
.prompt-target-card-info small,
.prompt-target-card-info em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-target-card-info strong {
  font-size: 0.83rem;
}

.prompt-target-card-info small {
  color: #9fb2c7;
  font-size: 0.68rem;
  font-style: normal;
}

.prompt-target-card-info em {
  color: var(--muted);
  font-size: 0.63rem;
  font-style: normal;
}

.prompt-target-card-check {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(139, 148, 158, 0.14);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prompt-target-card.active .prompt-target-card-check {
  background: rgba(88, 166, 255, 0.2);
  color: #79c0ff;
}

.prompt-target-card.previewing .prompt-target-card-check {
  background: rgba(46, 160, 67, 0.2);
  color: #7ee787;
}

.prompt-target-body-list {
  display: grid;
  gap: 5px;
  margin: -4px 8px 4px 88px;
}

.prompt-target-body-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid rgba(48, 54, 61, 0.72);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.66);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.prompt-target-body-card:hover,
.prompt-target-body-card.active {
  border-color: rgba(88, 166, 255, 0.72);
  background: rgba(56, 139, 253, 0.13);
}

.prompt-target-body-badge,
.prompt-target-body-action {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(88, 166, 255, 0.12);
  color: #79c0ff;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prompt-target-body-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

.prompt-target-body-action {
  background: rgba(139, 148, 158, 0.14);
  color: var(--muted);
}

.prompt-target-body-card.active .prompt-target-body-action {
  background: rgba(46, 160, 67, 0.18);
  color: #7ee787;
}

.prompt-target-body-loading {
  margin: -4px 8px 2px 88px;
  color: var(--muted);
  font-size: 0.65rem;
}

.prompt-target-popup-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.fusion-capability-modal {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(5px);
}

.fusion-capability-modal.hidden {
  display: none;
}

.fusion-capability-card {
  position: relative;
  width: min(720px, 94vw);
  padding: 22px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 20px;
  background:
    radial-gradient(circle at 18% 0%, rgba(88, 166, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255,255,255,0.06);
}

.fusion-capability-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.86);
  color: var(--muted);
  cursor: pointer;
}

.fusion-capability-close:hover {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.65);
}

.fusion-capability-head {
  max-width: 620px;
  margin-bottom: 16px;
}

.fusion-capability-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 3px 9px;
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 999px;
  color: #79c0ff;
  background: rgba(88, 166, 255, 0.1);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fusion-capability-head h2 {
  margin: 0 0 6px;
  font-size: 1.22rem;
}

.fusion-capability-head p,
.fusion-capability-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.fusion-capability-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fusion-capability-option {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px 12px;
  align-items: center;
  min-height: 132px;
  padding: 14px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 16px;
  background: rgba(13, 17, 23, 0.62);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.fusion-capability-option:hover,
.fusion-capability-option.active {
  border-color: rgba(88, 166, 255, 0.82);
  background: rgba(56, 139, 253, 0.13);
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.12);
}

.fusion-capability-icon {
  grid-row: span 2;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(88,166,255,0.28), rgba(163,113,247,0.16));
  color: #dbeafe;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.fusion-capability-icon--logo {
  background: rgba(255, 111, 0, 0.1);
  overflow: hidden;
}

.fusion-capability-icon--logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.fusion-capability-option strong {
  font-size: 0.9rem;
}

.fusion-capability-option small {
  color: #9fb2c7;
  line-height: 1.35;
}

.fusion-capability-note {
  margin-top: 14px;
  font-size: 0.74rem;
}

.fusion-aps-setup {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  background: rgba(8, 47, 73, 0.22);
}

.fusion-aps-setup strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.fusion-aps-setup ol {
  margin: 0;
  padding-left: 18px;
  color: #b6c5d8;
  font-size: 0.73rem;
  line-height: 1.45;
}

.fusion-aps-setup code,
.cloud-connection-row code {
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(13, 17, 23, 0.72);
  color: #bfdbfe;
  font-size: 0.68rem;
}

@media (max-width: 640px) {
  .fusion-capability-options {
    grid-template-columns: 1fr;
  }
}

#prompt-target-mode:hover,
#prompt-target-mode:focus,
#prompt-target-object:hover,
#prompt-target-object:focus {
  border-color: rgba(88, 166, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.14), inset 0 1px 0 rgba(255,255,255,0.08);
}

#prompt-pane-compose .prompt-skills-row {
  margin-bottom: 3px;
}

#prompt-pane-compose .prompt-image-drop {
  padding: 4px 8px;
  margin: 1px 0 3px;
  gap: 4px;
}

#prompt-pane-compose .prompt-image-drop strong {
  font-size: 0.72rem;
}

#prompt-pane-compose .prompt-image-drop span {
  display: none;
}

#prompt-pane-compose .prompt-image-list {
  margin-bottom: 2px;
}

#prompt-pane-compose .prompt-image-list:empty {
  display: none;
  margin: 0;
}

#prompt-pane-compose #btn-prompt,
#prompt-pane-compose #btn-stop-generation {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin-top: 2px;
  flex-shrink: 0;
  box-shadow: 0 -8px 16px rgba(13, 17, 23, 0.72);
}

#prompt-pane-compose #btn-stop-generation {
  position: static;
  bottom: auto;
  z-index: auto;
  box-shadow: none;
}

#prompt-pane-compose #prompt-status:empty,
#prompt-pane-compose #prompt-reply:empty {
  display: none;
  margin: 0;
}

#prompt-pane-compose #prompt-status,
#prompt-pane-compose #prompt-reply {
  margin-top: 4px;
}

.prompt-skills-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.prompt-skills-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.prompt-skills-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  max-height: 52px;
  overflow-x: hidden;
  overflow-y: auto;
}

.prompt-skills-chips.is-collapsed {
  display: none;
}

.prompt-skills-toggle {
  border: 1px solid #388bfd66;
  border-radius: 999px;
  background: #1f6feb18;
  color: #79c0ff;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11.5rem;
}

.prompt-skills-toggle::after {
  content: "▸";
  display: inline-block;
  margin-left: 6px;
  transition: transform 0.15s ease;
}

.prompt-skills-toggle[aria-expanded="true"]::after {
  transform: rotate(90deg);
}

.prompt-skills-toggle:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.16);
}

.prompt-skills-link {
  font-size: 0.72rem;
  margin-right: 0;
  flex-shrink: 0;
  white-space: nowrap;
}

.prompt-skills-trail {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.skills-manage-link {
  color: var(--accent);
  text-decoration: none;
}

.skills-manage-link:hover {
  text-decoration: underline;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #388bfd44;
  background: #1f6feb18;
  color: #79c0ff;
  font-size: 0.72rem;
  font-family: var(--mono, ui-monospace, monospace);
}

.skill-chip-prefix {
  color: #58a6ff;
  opacity: 0.85;
}

.skills-library-visual-page .info-main {
  position: relative;
  z-index: 1;
}

.skills-library-visual-page .skills-page {
  width: min(1280px, calc(100vw - 32px));
}

.skills-hero,
.skills-browser-controls,
.skills-list .skill-card,
.skill-detail {
  backdrop-filter: blur(12px);
}

.skills-hero {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(88, 166, 255, 0.26);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 16%, rgba(88, 166, 255, 0.22), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(249, 115, 22, 0.18), transparent 34%),
    rgba(13, 17, 23, 0.78);
  box-shadow: 0 20px 70px rgba(1, 4, 9, 0.34);
}

.skills-hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 8deg, rgba(249, 115, 22, 0.24) 0 8deg, transparent 8deg 18deg),
    radial-gradient(circle, transparent 0 42%, rgba(88, 166, 255, 0.18) 43% 50%, transparent 51%);
  opacity: 0.9;
  animation: skills-gear-spin 18s linear infinite;
  pointer-events: none;
}

.skills-hero > * {
  position: relative;
  z-index: 1;
}

.skills-browser-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0 12px;
  padding: 14px;
  border: 1px solid rgba(139, 148, 158, 0.24);
  border-radius: 18px;
  background: rgba(13, 17, 23, 0.72);
}

.skills-search,
.skills-sort {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.skills-search input,
.skills-sort select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 12px;
  background: rgba(1, 4, 9, 0.72);
  color: var(--text);
  font: inherit;
}

.skills-view-toggle {
  display: inline-flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(139, 148, 158, 0.24);
  border-radius: 999px;
  background: rgba(1, 4, 9, 0.52);
}

.skills-view-toggle button {
  border: 0;
  border-radius: 999px;
  padding: 8px 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.skills-view-toggle button.active {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.26), rgba(88, 166, 255, 0.2));
  color: #f0f6fc;
}

.skills-list {
  display: grid;
  gap: 14px;
  margin: 16px 0 24px;
}

.skills-list--grid {
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
}

.skills-list--list,
.skills-list--compact {
  grid-template-columns: 1fr;
}

.skill-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 12px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(88, 166, 255, 0.13), transparent 42%),
    rgba(13, 17, 23, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.skills-list--grid .skill-card {
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  aspect-ratio: 1 / 1.14;
  overflow: hidden;
}

.skill-card:hover,
.skill-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(88, 166, 255, 0.58);
  box-shadow: 0 18px 48px rgba(1, 4, 9, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  outline: none;
}

.skill-card-active {
  border-color: rgba(249, 115, 22, 0.62);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.18) inset, 0 0 28px rgba(249, 115, 22, 0.08);
}

.skills-list--list .skill-card {
  grid-template-columns: 120px minmax(0, 1fr);
  min-height: 148px;
}

.skills-list--compact .skill-card {
  grid-template-columns: 56px minmax(0, 1fr);
  min-height: 0;
  padding: 10px;
}

.skills-list--compact .skill-card-desc,
.skills-list--compact .skill-card-meta {
  display: none;
}

.skill-card-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 104px;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(88, 166, 255, 0.24);
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(rgba(88, 166, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.07) 1px, transparent 1px),
    rgba(1, 4, 9, 0.42);
  background-size: 18px 18px;
}

.skills-list--grid .skill-card-visual {
  min-height: 0;
  height: auto;
  aspect-ratio: 1 / 0.72;
}

.skills-list--compact .skill-card-visual {
  min-height: 56px;
  border-radius: 12px;
}

.skill-card-visual strong {
  position: relative;
  z-index: 2;
  color: #f0f6fc;
  font-size: 1.15rem;
  letter-spacing: -0.04em;
  text-shadow: 0 0 16px rgba(88, 166, 255, 0.74);
}

.skill-card-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 4;
}

.skill-anim-grid,
.skill-anim-path,
.skill-anim-object {
  position: absolute;
  pointer-events: none;
}

.skill-anim-grid {
  inset: 0;
  background:
    linear-gradient(rgba(88, 166, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.08) 1px, transparent 1px);
  background-size: 16px 16px;
  animation: skills-grid-drift 7s linear infinite;
}

.skill-anim-path {
  left: 16%;
  right: 16%;
  top: 48%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.85), rgba(251, 146, 60, 0.78), transparent);
  box-shadow: 0 0 16px rgba(88, 166, 255, 0.34);
  animation: skills-path-pulse 1.8s ease-in-out infinite;
}

.skill-anim-object {
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, #58a6ff, #fb923c);
  box-shadow: 0 0 18px rgba(251, 146, 60, 0.4);
}

.skill-anim-object--a {
  left: 18%;
  top: 38%;
  animation: skills-object-travel 3.6s ease-in-out infinite;
}

.skill-anim-object--b {
  right: 18%;
  bottom: 24%;
  opacity: 0.82;
  transform: scale(0.74);
  animation: skills-object-bob 2.8s ease-in-out infinite;
}

.skill-card-visual--build .skill-anim-object--a {
  clip-path: polygon(50% 0, 100% 38%, 100% 100%, 0 100%, 0 38%);
}

.skill-card-visual--make .skill-anim-object--a {
  border-radius: 50%;
  animation-name: skills-object-print;
}

.skill-card-visual--scan .skill-anim-path {
  top: 24%;
  bottom: 24%;
  left: 18%;
  width: 2px;
  height: auto;
  animation: skills-scan-line 2.2s ease-in-out infinite;
}

.skill-card-visual--robot .skill-anim-object--a {
  width: 42px;
  height: 10px;
  transform-origin: left center;
  animation: skills-robot-arm 2.4s ease-in-out infinite;
}

.skill-card-visual--cad .skill-anim-object--a {
  border-radius: 3px;
  animation: skills-cad-rotate 3.2s ease-in-out infinite;
}

.skill-card-orbit,
.skill-card-gear {
  position: absolute;
  border-radius: 50%;
}

.skill-card-orbit {
  inset: 18px;
  border: 1px dashed rgba(125, 211, 252, 0.46);
  animation: skills-gear-spin 8s linear infinite reverse;
}

.skill-card-gear {
  width: 70px;
  height: 70px;
  background:
    radial-gradient(circle, rgba(1, 4, 9, 0.92) 0 24%, rgba(253, 186, 116, 0.9) 25% 31%, transparent 32%),
    repeating-conic-gradient(from 0deg, rgba(88, 166, 255, 0.82) 0 9deg, rgba(249, 115, 22, 0.78) 9deg 15deg, transparent 15deg 22deg);
  filter: drop-shadow(0 0 16px rgba(88, 166, 255, 0.4));
  animation: skills-gear-spin 5.6s linear infinite;
}

.skill-card-category {
  display: inline-flex;
  width: max-content;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.14);
  color: #79c0ff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.skill-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.skill-card-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.skill-card-desc {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skills-list--grid .skill-card-desc {
  -webkit-line-clamp: 4;
}

.skill-card-meta {
  margin: 0 0 10px;
  line-height: 1.35;
}

.skill-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.skill-stats span {
  padding: 4px 8px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 999px;
  background: rgba(1, 4, 9, 0.36);
  color: #c9d1d9;
  font-size: 0.7rem;
  font-weight: 800;
}

.skill-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.skill-detail-meta {
  margin: 0.25rem 0;
}

.skill-toggle {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
}

.skill-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.skill-toggle-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #30363d;
  border: 1px solid var(--border);
  transition: background 0.15s;
}

.skill-toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c9d1d9;
  transition: transform 0.15s;
}

.skill-toggle input:checked + .skill-toggle-ui {
  background: #238636;
  border-color: #2ea043;
}

.skill-toggle input:checked + .skill-toggle-ui::after {
  transform: translateX(18px);
}

.skill-detail {
  margin: 0 0 24px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 20px;
  background:
    radial-gradient(circle at 8% 12%, rgba(88, 166, 255, 0.13), transparent 36%),
    rgba(13, 17, 23, 0.86);
  overflow: hidden;
  box-shadow: 0 20px 70px rgba(1, 4, 9, 0.28);
}

.skill-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.22);
}

.skill-detail-head h3 {
  margin: 0;
}

.skill-detail-grid {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 18px;
}

.skill-detail-grid .skill-card-visual {
  min-height: 140px;
}

.skill-detail-explainer {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-radius: 12px;
  background: rgba(88, 166, 255, 0.08);
  color: #dbeafe;
  line-height: 1.5;
}

.skill-media-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.skill-media-tools small {
  flex: 1 0 100%;
}

.skill-stats--detail {
  margin: 12px 0;
}

.skill-detail-body {
  margin: 0;
  padding: 16px;
  max-height: 420px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}

.skill-markdown-preview,
.skill-reference-preview {
  margin: 12px 18px 18px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 14px;
  background: rgba(1, 4, 9, 0.36);
  overflow: hidden;
}

.skill-markdown-preview summary,
.skill-reference-preview summary {
  padding: 10px 12px;
  color: #f0f6fc;
  font-weight: 800;
  cursor: pointer;
}

.skill-reference-preview section {
  padding: 0 12px 12px;
}

.skill-reference-preview pre {
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.9);
  color: var(--muted);
  font-size: 0.76rem;
  white-space: pre-wrap;
}

.skills-status {
  margin-top: 8px;
}

.skills-empty {
  padding: 18px;
  border: 1px dashed rgba(139, 148, 158, 0.35);
  border-radius: 16px;
  background: rgba(13, 17, 23, 0.62);
}

@keyframes skills-gear-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes skills-grid-drift {
  to { background-position: 16px 16px, -16px 16px; }
}

@keyframes skills-path-pulse {
  0%, 100% { opacity: 0.35; transform: scaleX(0.72); }
  50% { opacity: 1; transform: scaleX(1); }
}

@keyframes skills-object-travel {
  0%, 100% { transform: translate(-4px, 10px) rotate(-8deg); }
  50% { transform: translate(74px, -16px) rotate(12deg); }
}

@keyframes skills-object-bob {
  0%, 100% { transform: translateY(0) scale(0.74); }
  50% { transform: translateY(-12px) scale(0.82); }
}

@keyframes skills-object-print {
  0%, 100% { transform: translate(-6px, 16px) scale(0.72); opacity: 0.4; }
  40%, 70% { transform: translate(58px, -4px) scale(1); opacity: 1; }
}

@keyframes skills-scan-line {
  0%, 100% { transform: translateX(0); opacity: 0.42; }
  50% { transform: translateX(120px); opacity: 1; }
}

@keyframes skills-robot-arm {
  0%, 100% { transform: translate(18px, 26px) rotate(-28deg); }
  50% { transform: translate(64px, -4px) rotate(24deg); }
}

@keyframes skills-cad-rotate {
  0%, 100% { transform: translate(8px, 18px) rotateX(0deg) rotateZ(0deg); }
  50% { transform: translate(76px, -8px) rotateX(45deg) rotateZ(135deg); }
}

@media (max-width: 760px) {
  .skills-library-visual-page .skills-page {
    width: min(100%, calc(100vw - 20px));
  }

  .skills-browser-controls {
    grid-template-columns: 1fr;
  }

  .skills-view-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .skills-view-toggle button {
    flex: 1;
  }

  .skill-card,
  .skills-list--list .skill-card,
  .skills-list--compact .skill-card {
    grid-template-columns: 1fr;
  }

  .skills-list--compact .skill-card-visual {
    display: none;
  }

  .skill-detail-grid {
    grid-template-columns: 1fr;
  }
}

.prompt-history-summary {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.prompt-history-summary strong {
  color: var(--accent2);
  font-weight: 600;
}

.ph-summary-meta,
.ph-summary-tokens {
  color: var(--muted);
}

.ph-cost {
  color: var(--accent2);
  font-weight: 500;
}

.ph-mode {
  color: #f0c040;
  font-weight: 600;
  text-transform: lowercase;
}

.ph-speed {
  color: #7ee787;
  font-weight: 600;
}

.ph-model {
  color: #79c0ff;
  font-weight: 600;
}

.ph-model-label {
  color: #8b949e;
  font-weight: 500;
  margin-right: 2px;
}

.ph-model--unknown {
  color: #8b949e;
  font-weight: 500;
  font-style: italic;
}

.ph-improved {
  color: #d2a8ff;
  font-weight: 600;
}

.ph-target {
  font-weight: 600;
}

.ph-target--new {
  color: #3fb950;
}

.ph-target--edit {
  color: #ffa657;
}

.ph-codex {
  color: #58a6ff;
  font-weight: 600;
}

.ph-skills-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: -1px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.ph-skills-label {
  margin-right: 1px;
  font-weight: 600;
  color: #8b949e;
}

.ph-skill-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid #58a6ff44;
  border-radius: 999px;
  background: #1f6feb18;
  color: #a5d6ff;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.ph-skill-chip.hidden {
  display: none;
}

.ph-skills-toggle {
  padding: 1px 3px;
  border: 0;
  background: transparent;
  color: #79c0ff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ph-skills-toggle:hover,
.ph-skills-toggle:focus-visible {
  color: #a5d6ff;
  outline: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ph-view-more {
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #79c0ff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ph-view-more:hover,
.ph-view-more:focus-visible {
  color: #a5d6ff;
  outline: none;
}

.prompt-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 8px;
}

#prompt-pane-history.active .prompt-history-list,
#wiring-prompt-pane-history.active .prompt-history-list,
#rigging-prompt-pane-history.active .prompt-history-list {
  max-height: none;
  margin-bottom: 0;
}

.prompt-history-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.prompt-history-item:hover,
.prompt-history-item.ph-selected {
  border-color: var(--accent);
  background: #1f6feb12;
}

.prompt-history-item.ph-selected {
  box-shadow: inset 0 0 0 1px #1f6feb55;
}

.ph-avatar {
  width: 18px;
  height: 18px;
  display: inline-grid;
  margin-right: 5px;
  vertical-align: middle;
  font-size: 0.6rem;
}

.ph-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 5px 2px 2px;
  margin: -2px 0;
  border-radius: 999px;
  color: var(--text);
  cursor: copy;
}

.ph-user-chip:hover,
.ph-user-chip:focus-visible {
  background: #1f6feb24;
  outline: none;
}

.ph-person-menu {
  position: fixed;
  z-index: 120;
  width: min(360px, calc(100vw - 20px));
  padding: 8px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #0d1117;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.ph-person-menu-title {
  padding: 4px 6px 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ph-person-menu button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: copy;
}

.ph-person-menu button:hover,
.ph-person-menu button:focus-visible {
  background: #1f6feb24;
  outline: none;
}

.ph-person-menu strong,
.ph-person-menu span {
  display: block;
}

.ph-person-menu strong {
  margin-bottom: 3px;
  color: #79c0ff;
  font-size: 0.68rem;
}

.ph-person-menu span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ph-ref-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #1f6feb44;
  background: #1f6feb18;
  color: #79c0ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  line-height: 1.35;
  cursor: copy;
  word-break: break-all;
}

.ph-ref-btn:hover {
  background: #1f6feb30;
  border-color: #58a6ff;
}

.ph-body-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: inherit;
}

.prompt-ref-status {
  margin: 6px 0 8px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #3fb95044;
  background: #3fb95012;
  color: #7ee787;
  font-size: 0.72rem;
  line-height: 1.4;
  word-break: break-all;
}

.prompt-ref-status.hidden {
  display: none;
}

.ph-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
  min-width: 0;
}

.ph-status {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ph-status.ok { color: var(--accent2); }
.ph-status.err { color: var(--danger); }
.ph-status.pending { color: var(--accent); }

.ph-meta {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
  gap: 3px 8px;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
}

.ph-meta-part {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.ph-meta-part:not(:first-child)::before {
  content: "·";
  margin-right: 8px;
  color: #6e7681;
}

.ph-prompt {
  display: block;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.ph-reply {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.ph-reply.ph-error {
  color: var(--danger);
}

.prompt-history-empty {
  padding: 12px 0;
}

.status, .reply {
  margin-top: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.status.loading { color: var(--warn); }
.status.error { color: var(--danger); }
.status.ok { color: var(--accent2); }

.reply {
  color: var(--muted);
  max-height: 120px;
  overflow-y: auto;
}

.activity-log-section {
  padding: 8px 10px 10px;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.activity-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 6px;
}

.activity-log-actions { display: flex; gap: 4px; }

.small-btn {
  padding: 3px 8px;
  font-size: 0.68rem;
}

.activity-log-list {
  flex: 1;
  min-height: 0;
  max-height: 140px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--mono);
  font-size: 0.65rem;
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 6px;
}

.activity-log-list::-webkit-scrollbar {
  width: 6px;
}

.activity-log-list::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

.log-entry {
  border-bottom: 1px solid #21262d;
  padding: 5px 0;
}

.log-entry:last-child { border-bottom: none; }

.log-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  line-height: 1.4;
}

.log-time { color: var(--muted); }
.log-level { font-weight: 600; font-size: 0.6rem; }
.log-info .log-level { color: var(--accent); }
.log-error .log-level { color: var(--danger); }
.log-warn .log-level { color: var(--warn); }
.log-trace { color: #a371f7; }
.log-msg { flex: 1; min-width: 120px; color: var(--text); }
.log-ms, .log-status { color: var(--muted); }

.log-detail {
  display: none;
  margin-top: 4px;
  padding: 6px 8px;
  background: #161b22;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #adbac7;
  max-height: 160px;
  overflow: auto;
  font-size: 0.65rem;
}

.log-detail.open { display: block; }

.activity-log-footer {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
}

/* Info pages (Docs, Roadmap, Skills Library) */
.info-page,
.info-page #app {
  overflow: auto;
}

.info-page {
  min-height: 100%;
}

#app.app-info {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 52px 1fr;
  grid-template-areas:
    "header"
    "main";
  overflow: auto;
  height: auto;
  min-height: 100vh;
  transition: none;
}

.app-info {
  min-height: 100%;
}

.app-info .toolbar {
  grid-area: header;
  justify-content: flex-start;
  gap: 20px;
  width: 100%;
}

.app-info .toolbar-spacer {
  flex: 1 1 auto;
  min-width: 16px;
}

.info-main {
  grid-area: main;
  overflow-y: auto;
  padding: 32px 24px 64px;
  width: 100%;
  min-width: 0;
}

.info-content {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.info-hero {
  margin-bottom: 40px;
}

.info-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}

.info-hero h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.info-lead {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}

.info-section {
  margin-bottom: 36px;
}

.info-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.prompt-example-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--accent);
}

.info-section p,
.info-list li {
  line-height: 1.65;
  color: #c9d1d9;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-list li {
  padding-left: 16px;
  position: relative;
}

.info-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.info-feature-grid,
.info-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.info-feature-card,
.info-visual-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
}

.info-feature-card strong,
.info-feature-card span {
  display: block;
}

.info-feature-card strong,
.info-visual-card h4 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 0.95rem;
}

.info-feature-card span {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.86rem;
}

.info-visual-card .info-code {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .info-feature-grid,
  .info-visual-grid {
    grid-template-columns: 1fr;
  }
}

.api-list li::before {
  content: "→";
  font-size: 0.75rem;
}

.info-code {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #adbac7;
}

.info-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.info-table th,
.info-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.info-table th {
  background: #161b22;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-table tr:last-child td {
  border-bottom: none;
}

.info-table code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
}

.roadmap-phase {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.roadmap-phase.shipped { color: var(--accent2); }
.roadmap-phase.next { color: var(--accent); }
.roadmap-phase.future { color: var(--warn); }

.roadmap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.roadmap-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.roadmap-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.roadmap-item strong {
  display: block;
  margin-bottom: 0;
}

.roadmap-item p {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.roadmap-date {
  flex: 0 0 auto;
  color: #7ee787;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.roadmap-use {
  color: #c9d1d9 !important;
  font-size: 0.82rem !important;
}

.roadmap-show-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  padding: 6px 10px;
  border: 1px solid rgba(88, 166, 255, 0.36);
  border-radius: 999px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.2), transparent 42%),
    rgba(13, 17, 23, 0.86);
  color: #dbeafe;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.roadmap-show-btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #58a6ff;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.8);
}

.roadmap-show-btn:hover,
.roadmap-show-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(126, 200, 255, 0.8);
  background: rgba(56, 139, 253, 0.16);
  outline: none;
}

.roadmap-status {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.roadmap-item.done .roadmap-status {
  color: var(--accent2);
  border-color: rgba(63, 185, 80, 0.35);
  background: rgba(63, 185, 80, 0.08);
}

.roadmap-item .roadmap-status.planned {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.08);
}

.roadmap-item .roadmap-status.future {
  color: var(--warn);
  border-color: rgba(210, 153, 34, 0.35);
  background: rgba(210, 153, 34, 0.08);
}

@media (max-width: 640px) {
  .roadmap-item-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

.info-footer {
  font-size: 0.88rem;
  margin-top: 24px;
}

/* Edit tools panel */
.edit-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edit-tool-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.edit-tool-tab {
  padding: 6px 4px;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #21262d;
  color: var(--muted);
  cursor: pointer;
}

.edit-tool-tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.12);
}

.edit-tool-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-tool-pane.hidden {
  display: none;
}

.edit-hint {
  margin: 0;
}

.edit-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.edit-step-row select {
  flex: 1;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
}

.axis-field {
  display: grid;
  grid-template-columns: 28px 1fr 28px 28px;
  gap: 6px;
  align-items: center;
}

.axis-label {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
}

.axis-x .axis-label { color: #ff7b72; }
.axis-y .axis-label { color: #3fb950; }
.axis-z .axis-label { color: #58a6ff; }

.axis-field input {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.btn.nudge {
  padding: 4px 0;
  min-width: 28px;
  font-size: 0.85rem;
}

.scale-field,
.extrude-field,
.checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.scale-field input,
.extrude-field input {
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.extrude-target {
  font-size: 0.78rem;
  font-family: var(--mono);
  padding: 8px;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

#edit-status {
  min-height: 1.2em;
  font-size: 0.78rem;
}

/* Auth widget & modal */
.auth-widget {
  position: relative;
  margin-left: 8px;
  flex-shrink: 0;
}

.btn-auth {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #0d1117;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-auth:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(88, 166, 255, 0.08);
}

.btn-auth.signed-in {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(88, 166, 255, 0.12);
}

/* Onshape connection badge — logo pinned to bottom-right of avatar */
.onshape-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  min-width: 18px;
  max-width: 18px;
  min-height: 18px;
  max-height: 18px;
  border-radius: 50%;
  background: #0d1117;
  border: 2px solid #161b22;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.onshape-badge.hidden { display: none; }
.onshape-badge img {
  display: block;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  max-width: 16px;
  min-height: 16px;
  max-height: 16px;
  object-fit: contain;
  border-radius: 50%;
  background: transparent;
}

.fusion-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #161b22;
  display: grid;
  place-items: center;
  background: #0d1117;
  box-shadow: 0 0 12px rgba(255, 111, 0, 0.45);
  pointer-events: none;
  overflow: hidden;
}
.fusion-badge img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.fusion-badge.hidden { display: none; }

/* ── Management toolbar button (admin-only) ──────────────────────────── */
#btn-admin-dashboard-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(255,160,0,.13);
  border: 1px solid rgba(255,160,0,.35);
  border-radius: 6px;
  color: #ffb300;
  font-size: .75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
#btn-admin-dashboard-toolbar:hover {
  background: rgba(255,160,0,.22);
  border-color: rgba(255,160,0,.6);
}

.management-notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f85149;
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
}

.management-notification-badge.hidden {
  display: none;
}

#btn-admin-dashboard-toolbar.hidden {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

/* Non-admin: keep brand + nav tight on the far left (no Management spacer). */
body:not(.is-admin) .toolbar {
  padding-left: 6px;
  gap: 6px;
}
body:not(.is-admin) .brand {
  margin-right: 0;
}
body:not(.is-admin) .toolbar-nav {
  margin-right: 2px;
}

/* ── Admin dashboard link in user menu ───────────────────────────────── */
#btn-admin-dashboard {
  display: block;
  text-decoration: none;
  color: inherit;
}
#btn-admin-dashboard.hidden { display: none; }

.cloud-service-lights {
  position: absolute;
  top: -7px;
  right: -8px;
  display: flex;
  gap: 3px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.88);
  border: 1px solid rgba(48, 54, 61, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.cloud-service-light {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #30363d;
  color: #8b949e;
  font-size: 0.48rem;
  font-weight: 800;
  line-height: 1;
}

.cloud-service-light img,
.cloud-service-light svg {
  display: block;
  width: 10px;
  height: 10px;
  object-fit: contain;
}

.cloud-service-light.live {
  background: #2ea043;
  color: #f0fff4;
  box-shadow: 0 0 9px rgba(46, 160, 67, 0.75);
}

.cloud-service-light--fusion.live {
  background: linear-gradient(135deg, #0ea5e9, #22c55e);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.72);
}

.auth-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.auth-avatar--image {
  background-size: cover !important;
  background-position: center !important;
  color: transparent !important;
}

.auth-avatar-lg {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.15);
  flex-shrink: 0;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 500;
  min-width: 264px;
  max-width: 320px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu-header strong {
  display: block;
  font-size: 0.9rem;
}

.user-menu-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu-meta:empty,
.user-menu-meta:has(> :empty:only-child) {
  display: none;
}

.user-menu-ai-cost {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.56);
}

.user-menu-ai-cost-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.user-menu-ai-cost-label {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.user-menu-ai-cost-value {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.user-menu-ai-cost-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(139, 148, 158, 0.18);
}

.user-menu-ai-cost-bar > i {
  display: block;
  min-width: 0;
  height: 100%;
}

.user-menu-ai-cost-bar > i.claude,
.user-menu-ai-cost-legend .claude {
  background: #d97757;
}

.user-menu-ai-cost-bar > i.openai,
.user-menu-ai-cost-legend .openai {
  background: #10a37f;
}

.user-menu-ai-cost-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 0.64rem;
  color: var(--muted);
  line-height: 1.2;
}

.user-menu-ai-cost-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.user-menu-ai-cost-legend i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-menu-ai-cost-legend em {
  font-style: normal;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.user-menu-ai-cost.is-empty .user-menu-ai-cost-bar {
  opacity: 0.45;
}

.user-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.user-menu-section-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.user-menu-section-head span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}

.user-menu-section-head small {
  color: var(--muted);
  font-size: 0.7rem;
}

.user-menu-logout {
  width: 100%;
}

.user-menu-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.user-menu-item:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
}

.user-menu-item > span {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

.user-menu-item small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

/* Quest Book — gold, quest-reward styling so it stands out from every other row */
.user-menu-item--quest {
  position: relative;
  overflow: hidden;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(240, 185, 60, 0.55);
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.14), rgba(180, 120, 20, 0.1)),
    rgba(30, 22, 6, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 130, 0.28),
    0 0 12px rgba(240, 185, 60, 0.18);
}

.user-menu-item--quest::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 236, 170, 0.32), transparent);
  transform: skewX(-18deg);
  animation: quest-btn-shine 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes quest-btn-shine {
  0%, 62% { left: -70%; }
  86%, 100% { left: 130%; }
}

.user-menu-item--quest:hover {
  border-color: rgba(250, 204, 21, 0.85);
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.22), rgba(180, 120, 20, 0.14)),
    rgba(30, 22, 6, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 130, 0.35),
    0 0 16px rgba(240, 185, 60, 0.32);
}

.quest-book-btn-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #2a1c04;
  background: linear-gradient(160deg, #ffe9a3, #f5b93c 55%, #c47f17);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.4);
}

.quest-book-btn-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.quest-book-btn-text > span {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffe9a3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.quest-book-btn-text small {
  color: rgba(255, 233, 163, 0.75);
  font-size: 0.7rem;
  line-height: 1.3;
}

body.theme-light .user-menu-item--quest {
  background:
    linear-gradient(180deg, rgba(253, 230, 138, 0.55), rgba(251, 191, 36, 0.35)),
    rgba(255, 251, 235, 0.92);
  border-color: rgba(217, 119, 6, 0.55);
}

body.theme-light .quest-book-btn-text > span {
  color: #92400e;
  text-shadow: none;
}

body.theme-light .quest-book-btn-text small {
  color: rgba(146, 64, 14, 0.8);
}

/* ── Quest Book modal — FTB-Quests-style learning map ─────────────────────
   Deliberately darker and more game-y than the rest of the app, with gold
   quest-reward accents. Stays dark in the light theme on purpose. */
.quest-book-overlay {
  position: fixed;
  inset: 0;
  z-index: 940;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.quest-book-overlay.hidden {
  display: none;
}

.quest-book-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(3px);
}

.quest-book {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1180px, 100%);
  height: min(780px, 100%);
  border: 1px solid rgba(240, 185, 60, 0.35);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(1100px 420px at 18% -10%, rgba(240, 185, 60, 0.07), transparent 60%),
    #0b0e14;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 26px rgba(240, 185, 60, 0.1);
  color: #e6edf3;
}

.quest-book-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(240, 185, 60, 0.22);
  background: linear-gradient(180deg, rgba(240, 185, 60, 0.08), rgba(240, 185, 60, 0.02));
}

.quest-book-head-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #2a1c04;
  background: linear-gradient(160deg, #ffe9a3, #f5b93c 55%, #c47f17);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);
}

.quest-book-head-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.quest-book-head-titles strong {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffe9a3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.quest-book-head-titles span {
  font-size: 0.72rem;
  color: rgba(230, 237, 243, 0.55);
}

.quest-book-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: auto;
  min-width: 130px;
}

.quest-book-progress-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 233, 163, 0.85);
}

.quest-book-progress-track {
  width: 130px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.quest-book-progress-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #c47f17, #f5b93c, #ffe9a3);
  box-shadow: 0 0 8px rgba(240, 185, 60, 0.55);
  transition: width 0.4s ease;
}

.quest-book-close {
  margin-left: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(230, 237, 243, 0.7);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.quest-book-close:hover {
  border-color: rgba(240, 185, 60, 0.6);
  color: #ffe9a3;
  background: rgba(240, 185, 60, 0.1);
}

.quest-book-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Chapter tabs — book-spine sidebar */
.quest-book-tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 254px;
  flex-shrink: 0;
  padding: 10px 8px;
  overflow-y: auto;
  border-right: 1px solid rgba(240, 185, 60, 0.16);
  background: rgba(0, 0, 0, 0.28);
}

.quest-book-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(230, 237, 243, 0.72);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.quest-book-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e6edf3;
}

.quest-book-tab.active {
  border-color: rgba(240, 185, 60, 0.5);
  background: linear-gradient(180deg, rgba(240, 185, 60, 0.14), rgba(240, 185, 60, 0.05));
  color: #ffe9a3;
  box-shadow: inset 0 1px 0 rgba(255, 226, 130, 0.18);
}

.quest-book-tab-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

.quest-book-tab.active .quest-book-tab-icon {
  background: rgba(240, 185, 60, 0.18);
}

.quest-book-tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.quest-book-tab-count {
  flex-shrink: 0;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(230, 237, 243, 0.6);
}

.quest-book-tab.active .quest-book-tab-count {
  background: rgba(240, 185, 60, 0.2);
  color: #ffe9a3;
}

/* Main panel — chapter head + node-graph canvas + detail footer */
.quest-book-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.quest-book-chapter-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.quest-book-chapter-head strong {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #e6edf3;
}

.quest-chapter-blurb {
  font-size: 0.74rem;
  color: rgba(230, 237, 243, 0.5);
}

.quest-book-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background:
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 26px 26px;
}

.quest-graph {
  position: relative;
}

.quest-graph-links {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.quest-link {
  stroke: rgba(240, 185, 60, 0.3);
  stroke-width: 3;
  stroke-dasharray: 7 6;
  stroke-linecap: round;
}

/* Quest nodes — positioned at their center coordinates */
.quest-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.1), transparent 55%),
    #171c26;
  color: rgba(230, 237, 243, 0.75);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.quest-node:hover,
.quest-node:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  z-index: 3;
}

.quest-node.is-selected {
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25), 0 0 14px rgba(88, 166, 255, 0.35);
  z-index: 3;
}

.quest-node--completed {
  border-color: rgba(240, 185, 60, 0.85);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 236, 170, 0.28), transparent 60%),
    linear-gradient(160deg, rgba(240, 185, 60, 0.28), rgba(140, 90, 15, 0.3)),
    #1d1810;
  color: #ffe9a3;
  box-shadow: 0 0 12px rgba(240, 185, 60, 0.35);
}

.quest-node--available {
  border-color: rgba(88, 166, 255, 0.7);
  color: #cfe6ff;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.25);
  animation: quest-node-pulse 2.6s ease-in-out infinite;
}

@keyframes quest-node-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(88, 166, 255, 0.2); }
  50% { box-shadow: 0 0 16px rgba(88, 166, 255, 0.45); }
}

.quest-node--locked {
  border-color: rgba(255, 255, 255, 0.09);
  color: rgba(230, 237, 243, 0.28);
  background: #12151d;
}

.quest-node-check {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #0b0e14;
  background: linear-gradient(160deg, #ffe9a3, #f5b93c 60%, #c47f17);
  color: #2a1c04;
}

/* Hover tooltip */
.quest-node-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  max-width: 230px;
  padding: 8px 10px;
  border: 1px solid rgba(240, 185, 60, 0.35);
  border-radius: 8px;
  background: rgba(9, 11, 17, 0.96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 5;
}

.quest-node:hover .quest-node-tip,
.quest-node:focus-visible .quest-node-tip {
  opacity: 1;
  visibility: visible;
}

.quest-node-tip strong {
  font-size: 0.76rem;
  font-weight: 700;
  color: #ffe9a3;
}

.quest-node-tip span {
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(230, 237, 243, 0.75);
  white-space: normal;
}

.quest-node-tip em {
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(240, 185, 60, 0.8);
}

/* Detail footer */
.quest-book-detail {
  flex-shrink: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(240, 185, 60, 0.18);
  background: rgba(0, 0, 0, 0.3);
}

.quest-detail-empty {
  margin: 0;
  font-size: 0.76rem;
  color: rgba(230, 237, 243, 0.45);
}

.quest-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quest-detail-head > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.quest-detail-head strong {
  font-size: 0.84rem;
  font-weight: 700;
  color: #e6edf3;
}

.quest-detail-where {
  font-size: 0.68rem;
  color: rgba(230, 237, 243, 0.5);
}

.quest-detail-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(230, 237, 243, 0.7);
}

.quest-detail-icon--completed {
  border-color: rgba(240, 185, 60, 0.6);
  background: rgba(240, 185, 60, 0.14);
  color: #ffe9a3;
}

.quest-detail-icon--available {
  border-color: rgba(88, 166, 255, 0.5);
  background: rgba(88, 166, 255, 0.1);
  color: #cfe6ff;
}

.quest-detail-state {
  margin-left: auto;
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(230, 237, 243, 0.5);
}

.quest-detail-state--completed {
  border-color: rgba(240, 185, 60, 0.6);
  background: rgba(240, 185, 60, 0.12);
  color: #ffe9a3;
}

.quest-detail-state--available {
  border-color: rgba(88, 166, 255, 0.55);
  background: rgba(88, 166, 255, 0.1);
  color: #cfe6ff;
}

.quest-detail-summary {
  margin: 8px 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: rgba(230, 237, 243, 0.78);
}

.quest-detail-steps {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quest-detail-steps li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: rgba(230, 237, 243, 0.7);
}

.quest-step-box {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-top: 2px;
  border-radius: 3px;
  border: 1px solid rgba(240, 185, 60, 0.5);
  background: rgba(240, 185, 60, 0.06);
}

@media (max-width: 860px) {
  .quest-book-overlay {
    padding: 10px;
  }

  .quest-book-tabs {
    width: 64px;
  }

  .quest-book-tab-title,
  .quest-book-tab-count {
    display: none;
  }

  .quest-book-tab {
    justify-content: center;
  }
}

.cloud-connections-card {
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-radius: 12px;
  background:
    radial-gradient(circle at top right, rgba(46, 160, 67, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(88, 166, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.cloud-connections-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.cloud-connections-head span {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cloud-connections-head small {
  color: var(--muted);
}

.cloud-connection-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(48, 54, 61, 0.75);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.56);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.cloud-connection-row + .cloud-connection-row {
  margin-top: 6px;
}

.cloud-connection-row:hover,
.cloud-connection-row:focus-visible {
  border-color: rgba(88, 166, 255, 0.52);
  background: rgba(88, 166, 255, 0.12);
}

.cloud-connection-row.is-disconnected small {
  color: #7dd3fc;
  font-weight: 700;
}

.cloud-connection-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(88, 166, 255, 0.14);
  color: #58a6ff;
  font-weight: 800;
}

.cloud-connection-icon img,
.cloud-connection-icon svg {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.cloud-connection-icon--onshape {
  background: rgba(13, 17, 23, 0.68);
}

.cloud-connection-icon--fusion {
  background: rgba(255, 111, 0, 0.08);
}

.cloud-connection-row strong,
.cloud-connection-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-connection-row small {
  color: var(--muted);
  font-size: 0.68rem;
}

.profile-workspace-panel {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.92);
  max-height: min(520px, calc(100vh - 230px));
  overflow-y: auto;
}

.profile-preferences-panel {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4vw, 52px);
  background: rgba(1, 4, 9, 0.62);
  backdrop-filter: blur(8px);
}

.profile-preferences-card {
  position: relative;
  width: min(1080px, 94vw);
  max-height: min(780px, 90vh);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 26px;
  background:
    radial-gradient(circle at 16% -6%, rgba(251, 133, 0, 0.18), transparent 32%),
    radial-gradient(circle at 92% 8%, rgba(88, 166, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(7, 12, 20, 0.98));
  box-shadow:
    0 34px 110px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

body.theme-light .profile-preferences-panel {
  background:
    radial-gradient(circle at 16% 12%, rgba(14, 165, 233, 0.2), transparent 28%),
    radial-gradient(circle at 82% 20%, rgba(168, 85, 247, 0.16), transparent 32%),
    rgba(231, 238, 247, 0.74);
}

body.theme-light .profile-preferences-card {
  background:
    radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.18), transparent 34%),
    radial-gradient(circle at 92% 12%, rgba(20, 184, 166, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 249, 255, 0.98));
  border-color: rgba(59, 130, 246, 0.28);
  box-shadow: 0 28px 80px rgba(24, 35, 52, 0.18), 0 0 0 1px rgba(20, 184, 166, 0.08) inset;
}

.profile-preferences-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(13, 17, 23, 0.78);
  color: #d7dee8;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.22);
}

body.theme-light .profile-preferences-close {
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
}

.profile-preferences-close:hover {
  color: var(--text);
  border-color: rgba(251, 133, 0, 0.58);
  background: rgba(251, 133, 0, 0.12);
}

.profile-preferences-card .btn,
.profile-preferences-card label.btn {
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025)),
    rgba(13, 17, 23, 0.76);
  color: #edf4ff;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 12px 28px rgba(1, 4, 9, 0.22);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.profile-preferences-card .btn:hover,
.profile-preferences-card label.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(251, 133, 0, 0.62);
  background:
    linear-gradient(135deg, rgba(251, 133, 0, 0.18), rgba(88, 166, 255, 0.1)),
    rgba(13, 17, 23, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 16px 34px rgba(1, 4, 9, 0.28);
}

.profile-preferences-advanced-toggle.active {
  border-color: rgba(251, 133, 0, 0.72) !important;
  color: #0d1117 !important;
  background: linear-gradient(135deg, #fb8500, #ffd166) !important;
}

.profile-preferences-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 46px 18px 2px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.22);
  margin-bottom: 18px;
}

.profile-preferences-kicker {
  display: block;
  margin-bottom: 5px;
  color: #79c0ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-preferences-header h2 {
  margin: 0 0 4px;
  font-size: 1.55rem;
}

.profile-preferences-header p {
  margin: 0;
}

.profile-preferences-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-preferences-section--wide {
  grid-column: 1 / -1;
}

.profile-costs-panel {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.92);
  max-height: min(560px, calc(100vh - 230px));
  overflow-y: auto;
}

.profile-preferences-section {
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    rgba(13, 17, 23, 0.5);
  margin-bottom: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-light .profile-preferences-section {
  border-color: rgba(148, 163, 184, 0.44);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 251, 255, 0.66)),
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 40%);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body.theme-light .profile-preferences-section > strong {
  color: #1d4ed8;
}

body.theme-light .profile-avatar-preview {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(20, 184, 166, 0.16));
  border-color: rgba(37, 99, 235, 0.32);
}

body.theme-light .profile-pretty-input,
body.theme-light .profile-preference-field textarea.profile-pretty-input,
body.theme-light .profile-preference-field input.profile-pretty-input,
body.theme-light .profile-handle-input-wrap {
  color: #172033;
  border-color: rgba(59, 130, 246, 0.22);
  background:
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.78));
  box-shadow:
    0 12px 26px rgba(24, 35, 52, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

body.theme-light .profile-handle-field-prefix {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border-right-color: rgba(37, 99, 235, 0.16);
}

.profile-preferences-section > strong {
  display: block;
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.profile-avatar-preference {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar-preview {
  width: 66px;
  height: 66px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(251, 133, 0, 0.4);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.18), transparent 30%),
    rgba(88, 166, 255, 0.15);
  color: var(--accent);
  font-weight: 800;
  font-size: 1.2rem;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(1, 4, 9, 0.36), 0 0 0 4px rgba(251, 133, 0, 0.06);
}

.profile-avatar-preview--image {
  background-size: cover !important;
  background-position: center !important;
  color: transparent;
}

.profile-avatar-actions {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.profile-avatar-actions small {
  flex: 1 0 100%;
}

.profile-preference-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-identity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.72fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.profile-preference-field--stacked {
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
}

.profile-preference-field--bio {
  grid-column: 1 / -1;
}

.profile-preference-field > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-preference-field b {
  font-size: 0.86rem;
}

.profile-preference-field small,
.profile-preferences-note {
  color: var(--muted);
  line-height: 1.35;
}

.profile-preference-field select {
  flex: 0 0 210px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    #0d1117;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.profile-pretty-input,
.profile-preference-field textarea.profile-pretty-input,
.profile-preference-field input.profile-pretty-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    rgba(1, 4, 9, 0.54);
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 26px rgba(1, 4, 9, 0.18);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.profile-pretty-input::placeholder {
  color: rgba(139, 148, 158, 0.78);
}

.profile-pretty-input:focus,
.profile-preference-field textarea.profile-pretty-input:focus,
.profile-preference-field input.profile-pretty-input:focus {
  border-color: rgba(88, 166, 255, 0.66);
  box-shadow:
    0 0 0 3px rgba(88, 166, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 16px 34px rgba(1, 4, 9, 0.24);
}

.profile-preference-field textarea.profile-pretty-input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

.profile-handle-input-wrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0;
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.08), transparent 38%),
    rgba(1, 4, 9, 0.54);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 26px rgba(1, 4, 9, 0.18);
  overflow: hidden;
}

.profile-handle-input-wrap:focus-within {
  border-color: rgba(88, 166, 255, 0.66);
  box-shadow:
    0 0 0 3px rgba(88, 166, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 16px 34px rgba(1, 4, 9, 0.24);
}

.profile-handle-field-prefix {
  flex: 0 0 auto;
  align-self: stretch;
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.11);
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  font-weight: 900;
}

.profile-handle-input-wrap .profile-pretty-input {
  border: 0 !important;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding-left: 12px;
}

.profile-handle-status {
  flex: 0 0 auto;
  margin-right: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(139, 148, 158, 0.1);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

.profile-handle-status.is-checking {
  color: #a5d6ff;
  background: rgba(56, 139, 253, 0.13);
}

.profile-handle-status.is-ok {
  color: #3fb950;
  background: rgba(63, 185, 80, 0.13);
}

.profile-handle-status.is-error {
  color: #ff7b72;
  background: rgba(248, 81, 73, 0.13);
}

.profile-preferences-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.profile-preference-field select:focus {
  outline: none;
  border-color: rgba(251, 133, 0, 0.66);
  box-shadow: 0 0 0 3px rgba(251, 133, 0, 0.12);
}

.profile-preferences-note {
  margin: 8px 0 0;
}

.mouse-preset-guide {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.mouse-preset-guide div {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.55);
}

body.theme-light .mouse-preset-guide div {
  border-color: rgba(148, 163, 184, 0.36);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.86), rgba(240, 253, 250, 0.72));
}

body.theme-light .cloud-connections-card {
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.72), rgba(255, 247, 237, 0.58)),
    radial-gradient(circle at 100% 0%, rgba(251, 146, 60, 0.16), transparent 36%);
}

body.theme-light .cloud-connection-row {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(148, 163, 184, 0.42);
}

body.theme-light .cloud-connection-icon--onshape {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(20, 184, 166, 0.12));
}

body.theme-light .cloud-connection-icon--fusion {
  background: linear-gradient(135deg, rgba(255, 111, 0, 0.14), rgba(37, 99, 235, 0.1));
}

.mouse-preset-guide b {
  font-size: 0.78rem;
}

.mouse-preset-guide span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.profile-preferences-advanced-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.profile-preferences-premium-chip {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid rgba(251, 133, 0, 0.38);
  border-radius: 999px;
  color: #ffd166;
  background: rgba(251, 133, 0, 0.1);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-preferences-advanced-shell {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.profile-preferences-advanced-nav {
  position: sticky;
  top: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    rgba(1, 4, 9, 0.34);
}

.profile-preferences-advanced-nav button {
  appearance: none;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.profile-preferences-advanced-nav button b,
.profile-preferences-advanced-nav button small {
  display: block;
}

.profile-preferences-advanced-nav button b {
  color: #e6edf3;
  font-size: 0.84rem;
}

.profile-preferences-advanced-nav button small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.profile-preferences-advanced-nav button:hover,
.profile-preferences-advanced-nav button.active {
  transform: translateY(-1px);
  border-color: rgba(251, 133, 0, 0.36);
  background:
    radial-gradient(circle at 0% 0%, rgba(251, 133, 0, 0.14), transparent 48%),
    rgba(255, 255, 255, 0.04);
}

.profile-preferences-advanced-nav button.active b {
  color: #ffd166;
}

.profile-preferences-advanced-panels {
  min-width: 0;
}

.profile-preferences-category {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(88, 166, 255, 0.08), transparent 34%),
    rgba(1, 4, 9, 0.22);
}

.profile-preferences-category h3 {
  margin: 0;
  font-size: 0.98rem;
}

.profile-preference-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.profile-preference-switch span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.profile-preference-switch b {
  font-size: 0.86rem;
}

.profile-preference-switch small {
  color: var(--muted);
  line-height: 1.35;
}

.profile-preference-switch input {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.9);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.profile-preference-switch input::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #c9d1d9;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  transition: transform 0.16s ease, background 0.16s ease;
}

.profile-preference-switch input:checked {
  border-color: rgba(251, 133, 0, 0.7);
  background: linear-gradient(135deg, rgba(251, 133, 0, 0.72), rgba(255, 209, 102, 0.42));
}

.profile-preference-switch input:checked::after {
  transform: translateX(20px);
  background: #fff8e1;
}

body.theme-light .profile-preferences-card .btn,
body.theme-light .profile-preferences-card label.btn {
  color: #172033;
  border-color: rgba(59, 130, 246, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.82)),
    rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(24, 35, 52, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.theme-light .profile-preferences-card .btn:hover,
body.theme-light .profile-preferences-card label.btn:hover {
  border-color: rgba(251, 133, 0, 0.54);
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.96), rgba(239, 246, 255, 0.92));
}

body.theme-light .profile-preferences-premium-chip {
  color: #9a3412;
  background: rgba(255, 247, 237, 0.9);
}

body.theme-light .profile-preferences-advanced-nav,
body.theme-light .profile-preferences-category {
  border-color: rgba(148, 163, 184, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(239, 246, 255, 0.58)),
    rgba(255, 255, 255, 0.72);
}

body.theme-light .profile-preferences-advanced-nav button b,
body.theme-light .profile-preferences-category h3,
body.theme-light .profile-preference-switch b {
  color: #172033;
}

body.theme-light .profile-preferences-advanced-nav button:hover,
body.theme-light .profile-preferences-advanced-nav button.active,
body.theme-light .profile-preference-switch {
  border-color: rgba(251, 133, 0, 0.28);
  background:
    radial-gradient(circle at 0% 0%, rgba(251, 133, 0, 0.12), transparent 48%),
    rgba(255, 255, 255, 0.7);
}

body.theme-light .profile-preferences-advanced-nav button.active b {
  color: #9a3412;
}

@media (max-width: 760px) {
  .profile-preferences-panel {
    padding: 12px;
    align-items: stretch;
  }

  .profile-preferences-card {
    width: 100%;
    max-height: calc(100vh - 24px);
    padding: 18px;
  }

  .profile-preferences-grid {
    grid-template-columns: 1fr;
  }

  .profile-identity-grid {
    grid-template-columns: 1fr;
  }

  .profile-preference-field {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-preference-field select {
    flex-basis: auto;
    width: 100%;
  }

  .profile-preferences-advanced-shell {
    grid-template-columns: 1fr;
  }

  .profile-preferences-advanced-nav {
    position: static;
  }

  .profile-preferences-advanced-head {
    flex-direction: column;
  }
}

.profile-costs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}

.profile-cost-card {
  padding: 8px;
  border: 1px solid #21262d;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.profile-cost-card span,
.profile-cost-card strong {
  display: block;
}

.profile-cost-card strong {
  margin-top: 3px;
  font-size: 0.96rem;
}

.profile-costs-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 70px;
  padding: 8px 4px;
  border: 1px solid #21262d;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.profile-cost-bar {
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-width: 3px;
}

.profile-cost-bar > span {
  width: 100%;
  min-height: 3px;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  border-radius: 999px 999px 2px 2px;
  background: rgba(88, 166, 255, 0.14);
}

.profile-cost-bar i {
  display: block;
  width: 100%;
}

.profile-costs-legend {
  display: flex;
  gap: 10px;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
}

.profile-costs-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.profile-costs-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.profile-cost-bar .mine,
.profile-costs-legend .mine {
  background: var(--accent);
}

.profile-cost-bar .shared,
.profile-costs-legend .shared {
  background: var(--accent2);
}

.profile-costs-section {
  margin-top: 8px;
  border-top: 1px solid #21262d;
  padding-top: 8px;
}

.profile-costs-section-title,
.profile-cost-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-costs-section-title {
  margin-bottom: 6px;
}

.profile-cost-user {
  padding: 7px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.45);
  font-size: 0.75rem;
}

.profile-cost-user:last-child {
  border-bottom: none;
}

.profile-cost-user > div:first-child {
  min-width: 0;
}

.profile-cost-user strong,
.profile-cost-user span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-cost-user-stats {
  text-align: right;
  flex-shrink: 0;
}

.profile-costs-note {
  margin-top: 8px;
  line-height: 1.35;
}

.costs-modal-card {
  width: min(980px, calc(100vw - 42px));
}

.costs-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding-right: 26px;
}

.costs-modal-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.costs-modal-filters label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.costs-modal-filters select {
  min-width: 132px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
}

.costs-modal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.costs-modal-summary > div {
  padding: 10px;
  border: 1px solid #21262d;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.costs-modal-summary span,
.costs-modal-summary strong {
  display: block;
}

.costs-modal-summary span {
  color: var(--muted);
  font-size: 0.72rem;
}

.costs-modal-summary strong {
  margin-top: 4px;
  font-size: 1.05rem;
}

.costs-modal-chart {
  height: 230px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 14px 10px 30px;
  border: 1px solid #21262d;
  border-radius: 12px;
  background:
    linear-gradient(to top, rgba(255,255,255,0.055) 1px, transparent 1px) 0 0 / 100% 25%,
    rgba(255, 255, 255, 0.025);
  overflow-x: auto;
  overflow-y: hidden;
}

.costs-modal-bar {
  min-width: 18px;
  flex: 1 0 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
}

.costs-modal-bar > span {
  width: 100%;
  max-width: 22px;
  min-height: 3px;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  border-radius: 999px 999px 3px 3px;
  background: rgba(88, 166, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.18);
}

.costs-modal-bar > span.empty {
  opacity: 0.45;
  background: rgba(139, 148, 158, 0.28);
  box-shadow: none;
}

.costs-modal-bar i {
  display: block;
  width: 100%;
}

.costs-modal-bar .mine {
  background: var(--accent);
}

.costs-modal-bar .shared {
  background: var(--accent2);
}

.costs-modal-bar em {
  position: relative;
  top: 22px;
  color: var(--muted);
  font-size: 0.64rem;
  font-style: normal;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

.costs-modal-users {
  margin-top: 14px;
  border-top: 1px solid #21262d;
  padding-top: 10px;
}

.costs-modal-users h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.profile-workspace-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.profile-costs-expand {
  align-self: flex-start;
  margin-top: 6px;
}

#costs-analytics-modal.auth-modal {
  padding: 14px;
}

#costs-analytics-modal .costs-modal-card,
.auth-card.costs-modal-card,
.app-dialog-card.costs-modal-card {
  width: min(1500px, calc(100vw - 28px));
  max-width: none;
  height: min(920px, calc(100vh - 24px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 28px 30px;
}

.costs-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-shrink: 0;
}

.costs-modal-header > div:first-child {
  max-width: 300px;
}

.costs-modal-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 8px;
  min-width: min(760px, 100%);
}

.costs-modal-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.costs-modal-filters select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  padding: 7px 9px;
}

.costs-quickbar {
  display: grid;
  grid-template-columns: repeat(4, auto) minmax(280px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 8px 0 12px;
  flex-shrink: 0;
}

.costs-quickbar button {
  border: 1px solid #30363d;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.08);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.costs-quickbar button:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.16);
}

.costs-quickbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.costs-quickbar input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0d1117;
  color: var(--text);
  padding: 8px 10px;
}

.costs-modal-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto minmax(0, auto);
  gap: 10px;
  overflow: hidden;
}

.costs-modal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0 2px;
}

.costs-modal-summary > div {
  border: 1px solid #21262d;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.costs-modal-summary span,
.costs-modal-summary strong {
  display: block;
}

.costs-modal-summary span {
  color: var(--muted);
  font-size: 0.75rem;
}

.costs-modal-summary strong {
  margin-top: 4px;
  font-size: 1.05rem;
}

.costs-modal-chart {
  height: min(52vh, 470px);
  min-height: 320px;
  padding: 10px 12px;
  border: 1px solid #21262d;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.costs-modal-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cost-grid-line {
  stroke: rgba(139, 148, 158, 0.3);
  stroke-width: 1;
}

.cost-grid-line.muted {
  stroke: rgba(139, 148, 158, 0.13);
}

.cost-axis-label,
.cost-date-label {
  fill: var(--muted);
  font-size: 16px;
}

.cost-date-label {
  font-size: 15px;
}

.cost-bar-mine {
  fill: var(--accent);
}

.cost-bar-shared {
  fill: var(--accent2);
}

.cost-line-total {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cost-area-fill {
  fill: rgba(88, 166, 255, 0.16);
}

.costs-modal-feature-bars {
  min-height: 0;
  max-height: min(54vh, 520px);
  padding: 16px;
  border: 1px solid #21262d;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.costs-feature-row {
  display: grid;
  grid-template-columns: minmax(170px, 250px) minmax(220px, 1fr) minmax(90px, 120px);
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(33, 38, 45, 0.65);
}

.costs-feature-row:last-child {
  border-bottom: none;
}

.costs-feature-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.costs-feature-row div {
  height: 18px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.12);
  overflow: hidden;
}

.costs-feature-row i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.costs-feature-row i.mine {
  background: var(--accent);
}

.costs-feature-row i.shared {
  background: var(--accent2);
}

.costs-feature-row i.project {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.costs-feature-row strong {
  text-align: right;
  white-space: nowrap;
}

.costs-feature-row strong button {
  margin-left: 8px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
}

.costs-feature-row strong button:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.18);
}

.costs-project-group {
  border-bottom: 1px solid rgba(33, 38, 45, 0.65);
}

.costs-project-group:last-child {
  border-bottom: none;
}

.costs-project-group .costs-feature-row {
  border-bottom: none;
}

.costs-model-breakdown {
  margin: 0 0 8px 18px;
  padding: 8px 10px;
  border-left: 2px solid rgba(88, 166, 255, 0.38);
  border-radius: 10px;
  background: rgba(88, 166, 255, 0.055);
  display: grid;
  gap: 6px;
}

.costs-model-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.1fr) minmax(150px, 0.9fr) minmax(170px, auto);
  gap: 10px;
  align-items: center;
  font-size: 0.78rem;
}

.costs-model-row span {
  min-width: 0;
}

.costs-model-row span:first-child {
  display: grid;
  gap: 2px;
}

.costs-model-row small,
.costs-model-row > span:nth-child(2) {
  color: var(--muted);
}

.costs-model-row strong {
  text-align: right;
  white-space: nowrap;
}

.costs-modal-table {
  min-height: 320px;
  max-height: 100%;
  overflow: auto;
  border: 1px solid #21262d;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.costs-table-head,
.costs-table-row {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(130px, 1fr) minmax(110px, 0.8fr) minmax(130px, 0.9fr) 90px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
}

.costs-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0d1117;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.costs-sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-width: 0;
  cursor: pointer;
}

.costs-sort-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.costs-sort-btn i {
  color: #7d8590;
  font-style: normal;
  font-size: 0.78rem;
  line-height: 1;
}

.costs-sort-btn:hover,
.costs-sort-btn.active {
  color: var(--text);
}

.costs-sort-btn.active i {
  color: var(--accent);
}

.costs-table-row {
  font-size: 0.82rem;
}

.costs-table-row > span,
.costs-table-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.costs-table-row > span:first-child {
  display: grid;
  gap: 2px;
}

.costs-table-row small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.costs-modal-users {
  margin-top: 0;
  min-height: 0;
  max-height: min(20vh, 180px);
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding-right: 4px;
}

.costs-modal-users h3 {
  margin: 0 0 6px;
}

.costs-modal-users .profile-cost-user {
  padding: 5px 0;
}

.costs-feature-row span {
  display: grid;
  gap: 2px;
}

.costs-feature-row small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .costs-modal-header {
    flex-direction: column;
  }

  .costs-modal-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .costs-modal-card {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
  }

  .costs-modal-filters,
  .costs-quickbar {
    grid-template-columns: 1fr;
  }

  .costs-modal-chart {
    min-height: 260px;
  }
}

.profile-workspace-card {
  padding: 8px;
  border: 1px solid #21262d;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
}

.profile-workspace-head,
.profile-workspace-actions,
.profile-workspace-invite,
.profile-workspace-member {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-workspace-head {
  justify-content: space-between;
  margin-bottom: 7px;
}

.profile-workspace-head > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile-workspace-visible {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.profile-workspace-actions,
.profile-workspace-invite {
  margin: 6px 0;
}

.profile-workspace-actions input,
.profile-workspace-invite input {
  min-width: 0;
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #0d1117;
  color: var(--text);
  font-size: 0.76rem;
}

.profile-workspace-members {
  margin-top: 8px;
  border-top: 1px solid #21262d;
  padding-top: 6px;
}

.profile-workspace-member {
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.74rem;
  border-bottom: 1px solid rgba(48, 54, 61, 0.45);
}

.profile-workspace-member:last-child {
  border-bottom: none;
}

.profile-workspace-member span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-workspace-pending {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #30363d;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-modal.hidden {
  display: none;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.55);
  backdrop-filter: blur(4px);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.auth-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.auth-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-right: 24px;
}

.auth-logo {
  border-radius: 8px;
  flex-shrink: 0;
  width: 80px;
  height: 54px;
  object-fit: contain;
}

.auth-card-header h2 {
  margin: 0 0 2px;
  font-size: 1.15rem;
}

.auth-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── First-visit welcome modal ───────────────────────────────────────────── */

.welcome-modal {
  z-index: 10100;
}

.welcome-card {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  border-color: rgba(249, 115, 22, 0.32);
  background:
    radial-gradient(circle at 20% 0%, rgba(88, 166, 255, 0.17), transparent 36%),
    radial-gradient(circle at 84% 14%, rgba(249, 115, 22, 0.24), transparent 36%),
    linear-gradient(145deg, rgba(13, 17, 23, 0.98), rgba(7, 12, 20, 0.98));
}

.welcome-card .auth-close {
  z-index: 4;
}

.welcome-visual {
  position: relative;
  min-height: 228px;
  overflow: hidden;
  border-bottom: 1px solid rgba(48, 54, 61, 0.8);
  background:
    linear-gradient(rgba(88, 166, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.08) 1px, transparent 1px);
  background-size: 38px 38px;
}

.welcome-logo-badge {
  position: absolute;
  right: 22px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 286px;
  min-height: 158px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(249, 115, 22, 0.5);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 50%, rgba(13, 17, 23, 0.98) 0 51%, transparent 52%),
    repeating-conic-gradient(from 8deg, #fb923c 0 9deg, #7c2d12 9deg 16deg, transparent 16deg 22deg),
    radial-gradient(circle, rgba(249, 115, 22, 0.38), rgba(88, 166, 255, 0.12) 58%, transparent 72%);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.48),
    0 0 28px rgba(249, 115, 22, 0.22),
    inset 0 0 0 8px rgba(1, 4, 9, 0.6);
}

.welcome-logo-badge::before,
.welcome-logo-badge::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.welcome-logo-badge::before {
  inset: 15px;
  border-radius: 28px;
  border: 1px solid rgba(125, 211, 252, 0.3);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), transparent 31%),
    radial-gradient(circle at 22% 18%, rgba(125, 211, 252, 0.32), transparent 28%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.86), rgba(1, 4, 9, 0.8));
  box-shadow:
    inset 0 0 0 2px rgba(249, 115, 22, 0.12),
    inset 0 -18px 32px rgba(0, 0, 0, 0.32);
}

.welcome-logo-badge::after {
  inset: 4px;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.32) 44%, transparent 62%);
  opacity: 0.42;
  mix-blend-mode: screen;
  animation: welcome-gear-shine 3.8s ease-in-out infinite;
}

.welcome-logo-badge img {
  position: relative;
  z-index: 2;
  width: 240px;
  height: 76px;
  object-fit: contain;
  filter:
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 14px rgba(88, 166, 255, 0.36));
}

.welcome-logo-gear {
  position: absolute;
  z-index: 1;
  left: 18px;
  top: 28px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #07111d 0 18%, #7dd3fc 19% 24%, transparent 25%),
    radial-gradient(circle, transparent 0 45%, rgba(255, 237, 213, 0.88) 46% 50%, transparent 51%),
    repeating-conic-gradient(from 0deg, #67e8f9 0 8deg, #0e7490 8deg 14deg, transparent 14deg 22deg);
  filter:
    drop-shadow(0 0 12px rgba(125, 211, 252, 0.72))
    drop-shadow(0 0 18px rgba(249, 115, 22, 0.28));
  animation: welcome-render-gear-turn 2.2s linear infinite;
}

.welcome-logo-gear::before,
.welcome-logo-gear::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.welcome-logo-gear::before {
  inset: 26px;
  border: 3px solid rgba(253, 186, 116, 0.88);
  background: radial-gradient(circle, rgba(88, 166, 255, 0.95), rgba(7, 17, 29, 0.9) 58%);
  box-shadow: inset 0 0 12px rgba(1, 4, 9, 0.7);
}

.welcome-logo-gear::after {
  left: -7px;
  bottom: 17px;
  width: 22px;
  height: 22px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 237, 213, 0.9), transparent),
    radial-gradient(circle, rgba(249, 115, 22, 0.95), transparent 68%);
  filter: blur(0.4px) drop-shadow(0 0 10px rgba(249, 115, 22, 0.9));
  animation: welcome-gear-contact-spark 1.1s steps(2, end) infinite;
}

.welcome-logo-signup {
  position: relative;
  z-index: 3;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid rgba(255, 237, 213, 0.86);
  border-radius: 999px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.55), transparent 22% 40%, rgba(255, 255, 255, 0.32) 52%, transparent 68%),
    linear-gradient(180deg, #fff7ed 0%, #fdba74 34%, #f97316 72%, #9a3412 100%);
  color: #1f0f05;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow:
    0 8px 24px rgba(249, 115, 22, 0.38),
    0 0 22px rgba(88, 166, 255, 0.24),
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -3px 0 rgba(124, 45, 18, 0.42);
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.welcome-logo-signup::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -55%;
  width: 42%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  animation: welcome-signup-glint 2.5s ease-in-out infinite;
}

.welcome-logo-signup:hover,
.welcome-logo-signup:focus-visible {
  color: #1f0f05;
  outline: none;
  filter: saturate(1.12) brightness(1.08);
  transform: translateY(-1px) scale(1.03);
  box-shadow:
    0 12px 32px rgba(249, 115, 22, 0.5),
    0 0 30px rgba(88, 166, 255, 0.32),
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -3px 0 rgba(124, 45, 18, 0.42);
}

.welcome-robot {
  position: absolute;
  left: 78px;
  bottom: 14px;
  width: 360px;
  height: 170px;
  transform-origin: 82px 128px;
  animation: welcome-robot-float 4.6s ease-in-out infinite;
}

.welcome-robot-base {
  position: absolute;
  left: 12px;
  bottom: 0;
  width: 155px;
  height: 30px;
  border: 2px solid rgba(253, 186, 116, 0.9);
  border-radius: 999px;
  background: #9a3412;
}

.welcome-robot-joint {
  position: absolute;
  z-index: 2;
  display: block;
  border: 8px solid #fb923c;
  border-radius: 50%;
  background: #431407;
  box-shadow:
    0 0 0 4px rgba(255, 237, 213, 0.9),
    0 0 26px rgba(249, 115, 22, 0.34);
}

.welcome-robot-joint--base {
  left: 52px;
  bottom: 22px;
  width: 58px;
  height: 58px;
}

.welcome-robot-joint--elbow {
  left: 114px;
  bottom: 94px;
  width: 48px;
  height: 48px;
}

.welcome-robot-joint--wrist {
  left: 194px;
  bottom: 118px;
  width: 32px;
  height: 32px;
}

.welcome-robot-arm {
  position: absolute;
  display: block;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f97316, #fdba74);
  transform-origin: left center;
  box-shadow: inset 0 0 0 3px rgba(255, 237, 213, 0.35);
}

.welcome-robot-arm--lower {
  left: 87px;
  bottom: 72px;
  width: 120px;
  transform: rotate(-58deg);
  animation: welcome-robot-lower-service 4.6s ease-in-out infinite;
}

.welcome-robot-arm--upper {
  left: 166px;
  bottom: 136px;
  width: 150px;
  height: 24px;
  transform: rotate(-9deg);
  animation: welcome-robot-upper-service 4.6s ease-in-out infinite;
}

.welcome-robot-claw {
  position: absolute;
  left: 306px;
  bottom: 147px;
  width: 58px;
  height: 8px;
  border-radius: 999px;
  background: #fdba74;
  transform-origin: left center;
  animation: welcome-robot-claw-service 4.6s ease-in-out infinite;
}

.welcome-robot-claw--top {
  transform: rotate(-33deg);
}

.welcome-robot-claw--bottom {
  transform: rotate(31deg);
}

.welcome-copy {
  padding: 24px 28px 10px;
}

.welcome-copy h2 {
  max-width: 16ch;
  margin: 4px 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.welcome-copy p:not(.info-eyebrow) {
  max-width: 64ch;
  margin: 0;
  color: #c9d1d9;
  line-height: 1.55;
}

.welcome-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 28px 18px;
}

.welcome-feature-grid span {
  padding: 8px 10px;
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.08);
  color: #dbeafe;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.welcome-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 28px 16px;
}

.welcome-action {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.13), transparent 44%),
    rgba(13, 17, 23, 0.86);
  color: #e6edf3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.welcome-action:hover,
.welcome-action:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(88, 166, 255, 0.62);
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.22), transparent 45%),
    rgba(22, 27, 34, 0.95);
  outline: none;
}

.welcome-action--primary {
  border-color: rgba(249, 115, 22, 0.62);
  background:
    radial-gradient(circle at 0% 0%, rgba(253, 186, 116, 0.28), transparent 46%),
    linear-gradient(135deg, rgba(249, 115, 22, 0.24), rgba(88, 166, 255, 0.13)),
    rgba(22, 27, 34, 0.94);
}

.welcome-action--primary:hover,
.welcome-action--primary:focus-visible {
  border-color: rgba(253, 186, 116, 0.9);
  background:
    radial-gradient(circle at 0% 0%, rgba(253, 186, 116, 0.36), transparent 46%),
    linear-gradient(135deg, rgba(249, 115, 22, 0.32), rgba(88, 166, 255, 0.18)),
    rgba(22, 27, 34, 0.98);
}

.welcome-action-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(88, 166, 255, 0.14);
  color: #79b8ff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.welcome-action--primary .welcome-action-icon {
  background: rgba(249, 115, 22, 0.22);
  color: #fdba74;
}

.welcome-action strong,
.welcome-action small {
  display: block;
}

.welcome-action strong {
  font-size: 0.84rem;
  line-height: 1.2;
}

.welcome-action small {
  margin-top: 2px;
  color: #8b949e;
  font-size: 0.7rem;
  line-height: 1.2;
}

.welcome-dismiss {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 28px 24px;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

@keyframes welcome-robot-float {
  0%, 100% {
    transform: translateY(0) rotate(-1.5deg);
  }
  50% {
    transform: translateY(-8px) rotate(3deg);
  }
}

@keyframes welcome-render-gear-turn {
  to { transform: rotate(360deg); }
}

@keyframes welcome-gear-contact-spark {
  0%, 100% { opacity: 0.25; transform: scale(0.72) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.18) rotate(18deg); }
}

@keyframes welcome-robot-lower-service {
  0%, 100% { transform: rotate(-58deg); }
  45%, 62% { transform: rotate(-44deg); }
}

@keyframes welcome-robot-upper-service {
  0%, 100% { transform: rotate(-9deg); }
  45%, 62% { transform: rotate(-16deg); }
}

@keyframes welcome-robot-claw-service {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  45%, 62% { transform: translate(9px, -3px) rotate(-5deg); }
  52% { transform: translate(12px, -4px) rotate(-8deg) scaleX(0.92); }
}

@keyframes welcome-gear-shine {
  0%, 38%, 100% {
    transform: translateX(-48%) skewX(-10deg);
    opacity: 0;
  }
  52% {
    transform: translateX(18%) skewX(-10deg);
    opacity: 0.42;
  }
  66% {
    transform: translateX(54%) skewX(-10deg);
    opacity: 0;
  }
}

@keyframes welcome-signup-glint {
  0%, 42%, 100% {
    left: -55%;
    opacity: 0;
  }
  54% {
    opacity: 1;
  }
  72% {
    left: 118%;
    opacity: 0;
  }
}

@media (max-width: 700px) {
  .welcome-visual {
    min-height: 180px;
  }

  .welcome-robot {
    left: 24px;
    transform: scale(0.82);
    transform-origin: left bottom;
  }

  .welcome-logo-badge {
    right: 14px;
    width: 196px;
    min-height: 128px;
    padding: 14px;
    border-radius: 26px;
  }

  .welcome-logo-badge img {
    width: 168px;
    height: 54px;
  }

  .welcome-logo-gear {
    left: 10px;
    top: 24px;
    width: 68px;
    height: 68px;
  }

  .welcome-logo-signup {
    padding: 8px 13px;
    font-size: 0.74rem;
  }

  .welcome-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .welcome-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  background: #0d1117;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}

.auth-tab.active {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.auth-error {
  min-height: 1.2em;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--danger);
}

.auth-error:empty {
  display: none;
}

.auth-avatar-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.auth-avatar-upload-preview {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 800;
  background-size: cover !important;
  background-position: center !important;
  overflow: hidden;
}

.auth-avatar-upload-preview--image {
  color: transparent;
}

.auth-avatar-upload-copy {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.auth-avatar-upload-copy strong,
.auth-avatar-upload-copy small {
  flex: 1 0 100%;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.auth-form input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  font-weight: 600;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  color: var(--text-muted, #888);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border, #333);
}

.auth-social-btns {
  display: grid;
  gap: 8px;
}

.auth-social-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  font-weight: 700;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.auth-social-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(88, 166, 255, 0.65);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.auth-social-btn--apple {
  background: #050505;
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.auth-social-btn--disabled,
.auth-social-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-social-btn.is-loading .auth-social-icon {
  opacity: 0.4;
}

.auth-social-btn.is-loading::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid rgba(88, 166, 255, 0.28);
  border-top-color: #58a6ff;
  animation: auth-social-spin 0.8s linear infinite;
}

.auth-social-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

@keyframes auth-social-spin {
  to { transform: rotate(360deg); }
}

.auth-onshape-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border, #444);
  border-radius: 6px;
  background: transparent;
  color: var(--text, #eee);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.auth-onshape-btn:hover {
  background: var(--surface2, #2a2a2a);
  border-color: var(--accent, #5b8af5);
}
.auth-onshape-logo {
  display: block;
  width: 18px !important;
  height: 18px !important;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  flex: 0 0 auto;
}

.auth-autodesk-btn {
  margin-top: 8px;
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(34, 197, 94, 0.06));
}

.auth-autodesk-logo {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: block;
  object-fit: contain;
}

.auth-connect-opts {
  display: grid;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(88, 166, 255, 0.1), transparent 36%),
    rgba(13, 17, 23, 0.42);
}

.auth-connect-heading {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #c9d1d9;
  text-transform: uppercase;
}

.auth-connect-check {
  display: grid;
  grid-template-columns: 18px 24px 1fr;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.86rem;
  color: var(--text, #eee);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.auth-connect-check:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 166, 255, 0.38);
  background: rgba(88, 166, 255, 0.075);
}

.auth-connect-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-connect-box {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid rgba(139, 148, 158, 0.5);
  border-radius: 6px;
  background: rgba(1, 4, 9, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-connect-check input:checked + .auth-connect-box {
  border-color: rgba(63, 185, 80, 0.82);
  background: linear-gradient(135deg, rgba(35, 134, 54, 0.95), rgba(46, 160, 67, 0.72));
}

.auth-connect-check input:checked + .auth-connect-box::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.auth-connect-check .auth-onshape-logo,
.auth-connect-check .auth-autodesk-logo {
  width: 24px !important;
  height: 24px !important;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.auth-connect-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.auth-connect-copy strong {
  color: #f0f6fc;
  font-size: 0.82rem;
  line-height: 1.15;
}

.auth-connect-copy small {
  color: #8b949e;
  font-size: 0.68rem;
  line-height: 1.2;
}

.auth-connect-hint {
  margin: 0;
  line-height: 1.35;
  font-size: 0.7rem;
}

.share-arrival-modal {
  z-index: 2600;
}

.share-arrival-card {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 34px);
  overflow: auto;
  border-color: rgba(88, 166, 255, 0.22);
  background:
    radial-gradient(circle at top left, rgba(241, 138, 43, 0.16), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(88, 166, 255, 0.14), transparent 30%),
    rgba(13, 17, 23, 0.96);
}

.share-arrival-head {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.share-arrival-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f18a2b, #58a6ff);
  color: #06101f;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.share-arrival-eyebrow {
  margin: 0 0 2px;
  color: #ffb86b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.share-arrival-head h2 {
  margin: 0;
  color: #f0f6fc;
  font-size: 1.18rem;
}

.share-arrival-head p:last-child {
  margin: 3px 0 0;
  color: #8b949e;
  font-size: 0.84rem;
}

.share-arrival-targets {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}

.share-arrival-target {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.share-arrival-target:has(input:checked) {
  border-color: rgba(88, 166, 255, 0.52);
  background: rgba(88, 166, 255, 0.1);
}

.share-arrival-target input {
  margin-top: 2px;
  accent-color: #58a6ff;
}

.share-arrival-target strong {
  display: block;
  color: #f0f6fc;
  font-size: 0.86rem;
}

.share-arrival-target small {
  display: block;
  margin-top: 2px;
  color: #8b949e;
  font-size: 0.74rem;
}

.share-arrival-project-select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 10px;
  background: #0d1117;
  color: #f0f6fc;
}

.share-arrival-project-select:disabled {
  opacity: 0.52;
}

.share-arrival-collab {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 2px 0 0;
  color: #c9d1d9;
  font-size: 0.78rem;
}

.share-arrival-collab.hidden {
  display: none;
}

.share-arrival-collab input {
  margin-top: 2px;
  accent-color: #2ea043;
}

.share-arrival-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.share-arrival-action {
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  color: #dbeafe;
  font-weight: 750;
  cursor: pointer;
}

.share-arrival-action:hover:not(:disabled) {
  border-color: rgba(88, 166, 255, 0.54);
  background: rgba(88, 166, 255, 0.12);
}

.share-arrival-action--primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(241, 138, 43, 0.22), rgba(88, 166, 255, 0.16));
  border-color: rgba(241, 138, 43, 0.45);
  color: #fff2df;
}

.share-arrival-action:disabled {
  opacity: 0.56;
  cursor: wait;
}

.share-arrival-status {
  min-height: 1em;
  margin: 10px 0 0;
}

@media (max-width: 560px) {
  .share-arrival-actions {
    grid-template-columns: 1fr;
  }

  .share-arrival-action--primary {
    grid-column: auto;
  }
}

.auth-autodesk-logo-lg {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  flex: 0 0 auto;
}

.autodesk-config-card {
  width: min(520px, calc(100vw - 28px));
}

#autodesk-config-form input {
  font-family: inherit;
}

/* ── Multi-key manager ─────────────────────────────────────────────── */
.ai-keys-card {
  max-width: 560px;
  width: 94vw;
  max-height: calc(100vh - 48px);
}

.ai-keys-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 12px;
}

.ai-credit-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 122, 47, 0.28);
  border-radius: 20px;
  padding: 0;
  background:
    radial-gradient(ellipse 80% 60% at 100% -10%, rgba(255, 140, 64, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at -10% 110%, rgba(56, 189, 248, 0.14), transparent 50%),
    linear-gradient(165deg, #14181f 0%, #0c1016 55%, #10151c 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.ai-credit-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff8a3d 30%, #38bdf8 70%, transparent);
  opacity: 0.9;
}

.ai-credit-card--active {
  border-color: rgba(56, 189, 248, 0.45);
}

.ai-credit-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
}

.ai-credit-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ai-credit-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: #ffb07a;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-credit-brand strong {
  color: #f4f7fb;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ai-credit-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ai-credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
}

.ai-credit-pill--on {
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.ai-credit-pill--off {
  opacity: 0.55;
}

.ai-credit-balance-block {
  text-align: right;
  flex-shrink: 0;
}

.ai-credit-balance-label {
  display: block;
  color: #94a3b8;
  font-size: 0.68rem;
  margin-bottom: 4px;
}

.ai-credit-balance {
  display: inline-block;
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 14px;
  color: #e0f2fe;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  background: linear-gradient(145deg, rgba(14, 165, 233, 0.18), rgba(255, 122, 47, 0.12));
  font-variant-numeric: tabular-nums;
}

.ai-credit-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 12px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.ai-credit-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 6px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ai-credit-tab:hover {
  color: #e2e8f0;
}

.ai-credit-tab--active {
  background: linear-gradient(135deg, rgba(255, 122, 47, 0.28), rgba(56, 189, 248, 0.22));
  color: #f8fafc;
}

.ai-credit-panel {
  padding: 12px 16px 16px;
}

.ai-credit-copy {
  margin: 0 0 12px;
  color: #cbd5e1;
  font-size: 0.82rem;
  line-height: 1.45;
}

.ai-credit-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  margin-bottom: 8px;
}

.ai-credit-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8a3d, #38bdf8);
}

.ai-credit-meter-label {
  color: #94a3b8;
  font-size: 0.7rem;
  margin-bottom: 12px;
}

.ai-credit-amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.ai-credit-amount {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  font: inherit;
  font-weight: 700;
  padding: 12px 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.ai-credit-amount:hover {
  border-color: rgba(255, 138, 61, 0.45);
}

.ai-credit-amount--selected {
  border-color: rgba(56, 189, 248, 0.55);
  background: linear-gradient(160deg, rgba(255, 122, 47, 0.18), rgba(14, 165, 233, 0.16));
  transform: translateY(-1px);
}

.ai-credit-amount small {
  display: block;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 0.65rem;
  font-weight: 600;
}

.ai-credit-buy-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-credit-btn-primary,
.ai-credit-btn-buy {
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  padding: 11px 16px;
  cursor: pointer;
}

.ai-credit-btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #f8fafc;
}

.ai-credit-btn-buy {
  flex: 1;
  min-width: 160px;
  background: linear-gradient(135deg, #ff8a3d, #f97316 45%, #0ea5e9);
  color: #0b1220;
  box-shadow: 0 10px 24px rgba(249, 115, 22, 0.22);
}

.ai-credit-btn-buy:disabled,
.ai-credit-btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ai-credit-btn-ghost {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: transparent;
  color: #cbd5e1;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  cursor: pointer;
}

.ai-credit-manage-grid {
  display: grid;
  gap: 10px;
}

.ai-credit-field {
  display: grid;
  gap: 5px;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-credit-field select {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: #0b1220;
  color: #e2e8f0;
  font: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 9px 10px;
}

.ai-credit-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #cbd5e1;
  font-size: 0.8rem;
  line-height: 1.35;
}

.ai-credit-toggle-row input {
  margin-top: 2px;
}

.ai-credit-note {
  margin: 12px 0 0;
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.4;
}

.ai-credit-tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.ai-credit-tx {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.35);
}

.ai-credit-tx strong {
  color: #e2e8f0;
  font-size: 0.8rem;
}

.ai-credit-tx-meta {
  grid-column: 1 / -1;
  color: #94a3b8;
  font-size: 0.68rem;
}

.ai-credit-tx-amt {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}

.ai-credit-tx-amt--pos {
  color: #7dd3fc;
}

.ai-credit-tx-amt--neg {
  color: #fdba74;
}

.ai-credit-empty {
  color: #94a3b8;
  font-size: 0.8rem;
  text-align: center;
  padding: 18px 8px;
}

.ai-keys-empty {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 12px 0;
}

.ai-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .15s;
}

.ai-key-row--active {
  border-color: #388bfd66;
  background: rgba(56,139,253,.07);
}

.ai-key-row-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.ai-key-row-name {
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.ai-key-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: .03em;
  white-space: nowrap;
}

.ai-setup-intro-modal {
  z-index: 10120;
}

.ai-setup-intro-card {
  border-color: rgba(251, 146, 60, 0.4);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(251, 146, 60, 0.14),
    0 0 46px rgba(251, 146, 60, 0.12);
}

.ai-setup-visual {
  background:
    radial-gradient(circle at 24% 22%, rgba(251, 146, 60, 0.24), transparent 30%),
    radial-gradient(circle at 76% 35%, rgba(56, 189, 248, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(12, 18, 32, 0.95), rgba(5, 9, 20, 0.98));
}

.ai-setup-logo-badge {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  width: 342px;
  padding: 18px 18px 16px 118px;
  box-shadow:
    0 18px 48px rgba(251, 146, 60, 0.22),
    inset 0 0 0 1px rgba(253, 186, 116, 0.34),
    inset 0 -18px 34px rgba(0, 0, 0, 0.38);
}

.ai-setup-logo-badge .welcome-logo-gear {
  left: 18px;
  top: 31px;
}

.ai-setup-logo-badge img {
  width: 118px;
  height: 48px;
  transform: translateY(-12px);
  animation: ai-setup-logo-pulse 2.15s ease-in-out infinite;
}

.ai-setup-logo-cta {
  min-width: 136px;
  height: 48px;
  padding: 0 20px;
  transform: translateY(-12px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), transparent 45%),
    linear-gradient(135deg, #fed7aa, #fb923c 48%, #f97316);
}

.ai-setup-logo-cta:hover,
.ai-setup-logo-cta:focus-visible {
  transform: translateY(-14px) scale(1.03);
}

@keyframes ai-setup-logo-pulse {
  0%,
  100% {
    filter:
      drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45))
      drop-shadow(0 0 12px rgba(88, 166, 255, 0.35));
    opacity: 0.88;
  }
  48% {
    filter:
      drop-shadow(0 12px 22px rgba(0, 0, 0, 0.48))
      drop-shadow(0 0 26px rgba(56, 189, 248, 0.82))
      drop-shadow(0 0 16px rgba(251, 146, 60, 0.34));
    opacity: 1;
    transform: translateY(-12px) scale(1.05);
  }
}

@media (max-width: 700px) {
  .ai-setup-logo-badge {
    width: min(318px, calc(100% - 28px));
    min-height: 142px;
    padding-left: 100px;
    gap: 8px;
  }

  .ai-setup-logo-badge .welcome-logo-gear {
    left: 12px;
    top: 32px;
    width: 82px;
    height: 82px;
  }

  .ai-setup-logo-badge img {
    width: 92px;
    height: 42px;
  }

  .ai-setup-logo-cta {
    min-width: 116px;
    height: 42px;
    padding: 0 14px;
    font-size: 0.72rem;
  }
}

.ai-setup-copy h2 {
  color: #fff7ed;
}

.ai-setup-step-grid span {
  border-color: rgba(251, 146, 60, 0.28);
  background: rgba(251, 146, 60, 0.08);
  color: #fed7aa;
}

.badge-openai {
  background: rgba(16,185,129,.18);
  color: #34d399;
  border: 1px solid rgba(16,185,129,.3);
}

.badge-claude {
  background: rgba(139,92,246,.18);
  color: #c084fc;
  border: 1px solid rgba(139,92,246,.3);
}

.ai-key-row-model {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
}

.ai-key-model-select {
  font-size: 0.74rem;
  color: var(--text);
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.12s;
  max-width: 170px;
}

.ai-key-model-select:hover,
.ai-key-model-select:focus {
  border-color: var(--accent);
}

.ai-key-row--active .ai-key-model-select {
  border-color: #1f6feb;
  color: #58a6ff;
}

.ai-key-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ai-key-active-badge {
  font-size: .75rem;
  color: #58a6ff;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(88,166,255,.12);
  border-radius: 6px;
  border: 1px solid rgba(88,166,255,.25);
}

.ai-key-btn-activate {
  font-size: .75rem;
  padding: 3px 9px;
  background: rgba(35,134,54,.25);
  border-color: #238636;
  color: #56d364;
}

.ai-key-btn-activate:hover { background: rgba(35,134,54,.4); }

.ai-keys-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.ai-keys-section-hint {
  margin: 0 0 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}
.ai-key-row--platform {
  background: rgba(210, 153, 34, 0.05);
  border-color: #30363d;
}
.ai-key-row--disabled {
  opacity: 0.62;
}
.ai-keys-section-label--with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-keys-section-label--with-action .ai-key-btn-share {
  text-transform: none;
  letter-spacing: 0;
}

.ai-key-row--team {
  background: rgba(88, 166, 255, 0.04);
  border-color: #21262d;
}

.ai-key-row--team .ai-key-row-info {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  flex: 1;
}

.ai-key-row-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-key-team-members {
  max-width: 360px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-key-team-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  margin: -4px 0 4px;
}

.ai-key-team-filter select {
  min-width: 160px;
  max-width: 230px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0d1117;
  color: var(--text);
}

.ai-key-team-add {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.ai-key-team-add input {
  flex: 1;
  min-width: 0;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.78rem;
  padding: 6px 8px;
  outline: none;
}

.ai-key-team-add input:focus {
  border-color: var(--accent);
}

.ai-key-team-subtitle {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 10px 0 4px;
  text-transform: uppercase;
}

.ai-key-team-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-key-team-note {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 8px;
  line-height: 1.35;
}

.ai-key-shared-by {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

.ai-key-btn-team-toggle {
  font-size: .75rem;
  padding: 3px 9px;
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.ai-key-btn-team-toggle:hover,
.ai-key-btn-team-toggle.active {
  background: rgba(35,134,54,.25);
  border-color: #238636;
  color: #56d364;
}

.ai-key-btn-manage-access {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  padding: 3px 9px;
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.ai-key-btn-manage-access:hover,
.ai-key-btn-manage-access.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(88,166,255,.08);
}

/* Members panel */
.ai-key-members-panel {
  background: #0d1117;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
}

.ai-key-members-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ai-key-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid #21262d;
}

.ai-key-member-row:last-child { border-bottom: none; }

.ai-key-member-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-key-member-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 360px;
}

.ai-key-member-model-select {
  max-width: 150px;
}

.ai-key-daily-limit {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.ai-key-daily-limit input {
  width: 104px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #0d1117;
  color: var(--text);
  font-size: 0.72rem;
}

.ai-key-daily-limit input:focus {
  outline: none;
  border-color: var(--accent);
}

.ai-key-member-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(88,166,255,.15);
  color: #58a6ff;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-key-member-name {
  font-size: 0.8rem;
  color: var(--text);
  display: block;
}

.ai-key-member-email {
  font-size: 0.7rem;
  color: var(--muted);
  display: block;
}

.ai-key-grant-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 3px 9px;
  background: rgba(248,81,73,.12);
  border-color: rgba(248,81,73,.3);
  color: #f85149;
  transition: all 0.12s;
}

.ai-key-grant-btn.active {
  background: rgba(35,134,54,.2);
  border-color: #238636;
  color: #56d364;
}

.ai-key-grant-btn:hover { opacity: 0.85; }
.ai-key-grant-btn:disabled { opacity: 0.5; cursor: wait; }

.ai-key-members-loading,
.ai-key-members-error,
.ai-key-members-empty {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 4px 0;
}

.ai-key-members-error { color: #f85149; }

.ai-key-btn-rename {
  font-size: .8rem;
  padding: 3px 7px;
  color: var(--muted);
}

.ai-key-btn-rename:hover { color: var(--fg); }

.ai-key-btn-delete {
  font-size: .8rem;
  padding: 3px 7px;
  color: #ff7b72;
  background: rgba(218,54,51,.12);
  border-color: rgba(218,54,51,.3);
}

.ai-key-btn-delete:hover { background: rgba(218,54,51,.25); }

/* Add-key collapsible section */
.ai-key-add-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ai-key-add-toggle {
  cursor: pointer;
  padding: 9px 12px;
  font-size: .85rem;
  font-weight: 600;
  color: #58a6ff;
  list-style: none;
  user-select: none;
}

.ai-key-add-toggle::-webkit-details-marker { display: none; }
.ai-key-add-toggle::marker { display: none; }

.ai-key-add-toggle:hover { background: rgba(88,166,255,.06); }

.ai-key-add-form {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}

.ai-keys-card .auth-form {
  gap: 14px;
}

.ai-keys-card .auth-form label:not(.ai-key-share-toggle) {
  gap: 8px;
  color: #9ba7b4;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ai-keys-card .auth-form input:not([type="checkbox"]),
.ai-keys-card .auth-form select {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.92), rgba(7, 12, 22, 0.98));
  color: #e6edf3;
  padding: 11px 13px;
  font: inherit;
  font-size: 0.9rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.16);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.ai-keys-card .auth-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background:
    linear-gradient(45deg, transparent 50%, #79c0ff 50%) calc(100% - 20px) 18px / 6px 6px no-repeat,
    linear-gradient(135deg, #79c0ff 50%, transparent 50%) calc(100% - 14px) 18px / 6px 6px no-repeat,
    linear-gradient(180deg, rgba(22, 27, 34, 0.92), rgba(7, 12, 22, 0.98));
}

.ai-keys-card .auth-form input:not([type="checkbox"])::placeholder {
  color: rgba(139, 148, 158, 0.78);
}

.ai-keys-card .auth-form input:not([type="checkbox"]):hover,
.ai-keys-card .auth-form select:hover {
  border-color: rgba(88, 166, 255, 0.45);
}

.ai-keys-card .auth-form input:not([type="checkbox"]):focus,
.ai-keys-card .auth-form select:focus {
  outline: none;
  border-color: rgba(88, 166, 255, 0.78);
  background:
    linear-gradient(180deg, rgba(18, 29, 47, 0.96), rgba(7, 12, 22, 0.98));
  box-shadow:
    0 0 0 3px rgba(88, 166, 255, 0.18),
    0 14px 34px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ai-keys-card .auth-form select:focus {
  background:
    linear-gradient(45deg, transparent 50%, #a5d6ff 50%) calc(100% - 20px) 18px / 6px 6px no-repeat,
    linear-gradient(135deg, #a5d6ff 50%, transparent 50%) calc(100% - 14px) 18px / 6px 6px no-repeat,
    linear-gradient(180deg, rgba(18, 29, 47, 0.96), rgba(7, 12, 22, 0.98));
}

.ai-keys-card .auth-submit {
  min-height: 44px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    linear-gradient(135deg, #238636, #2ea043);
  box-shadow:
    0 14px 34px rgba(46, 160, 67, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.ai-key-share-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.82rem;
  margin-top: 2px;
}

.ai-key-share-toggle input {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid rgba(139, 148, 158, 0.46);
  border-radius: 5px;
  background: rgba(13, 17, 23, 0.96);
  display: inline-grid;
  place-items: center;
}

.ai-key-share-toggle input:checked {
  border-color: rgba(46, 160, 67, 0.76);
  background: linear-gradient(135deg, #238636, #2ea043);
}

.ai-key-share-toggle input:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg);
}

#ai-key-team-label {
  margin-top: 2px;
}

#ai-key-share-hint {
  margin: -2px 0 2px;
  line-height: 1.35;
}

.collab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.collab-badge {
  position: absolute;
  bottom: -1px;
  right: -1px;
  border: 2px solid var(--panel);
  opacity: 0;
  transition: opacity 0.15s;
}

.collab-badge.live {
  opacity: 1;
}

.collab-dot.live {
  background: #3fb950;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.6);
}

.collab-presence {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#user-label {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Team panel */
.team-panel {
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.team-invites-alert {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.team-invites-alert.hidden {
  display: none;
}

.team-invite-banner {
  padding: 10px;
  background: rgba(56, 139, 253, 0.12);
  border: 1px solid rgba(56, 139, 253, 0.35);
  border-radius: 8px;
  font-size: 0.82rem;
}

.team-invite-banner p {
  margin: 0 0 8px;
  line-height: 1.4;
}

.team-invite-actions {
  display: flex;
  gap: 6px;
}

.workspace-switcher-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
}

.workspace-switcher-row .team-select {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.team-select {
  width: 100%;
  margin: 8px 0;
  padding: 6px 8px;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.85rem;
}

.btn-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0d1117;
  color: var(--muted);
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--text);
  border-color: #484f58;
  background: #21262d;
}

.btn-icon svg {
  display: block;
}

.app-dialog-card {
  width: min(400px, 100%);
}

.app-dialog-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.app-dialog-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.app-dialog-label input,
.app-dialog-label select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.9rem;
}

.app-dialog-label select {
  cursor: pointer;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.app-rename-modal {
  z-index: 10060;
}

.app-rename-backdrop {
  background:
    radial-gradient(circle at 50% 35%, rgba(88, 166, 255, 0.18), transparent 34%),
    rgba(1, 4, 9, 0.68);
  backdrop-filter: blur(8px);
}

.app-rename-card {
  width: min(460px, calc(100vw - 32px));
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(88, 166, 255, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(33, 38, 45, 0.98), rgba(13, 17, 23, 0.98)),
    var(--panel);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-rename-close {
  top: 14px;
  right: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.035);
}

.app-rename-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.36), rgba(63, 185, 80, 0.14));
  color: #79c0ff;
  box-shadow: 0 10px 28px rgba(31, 111, 235, 0.18);
}

.app-rename-eyebrow {
  margin: 0 36px 6px 0;
  color: #79c0ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.app-rename-title {
  margin: 0 36px 6px 0;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}

.app-rename-description {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.app-rename-label {
  display: grid;
  gap: 7px;
  margin: 0;
  color: #c9d1d9;
  font-weight: 700;
}

.app-dialog-label .app-rename-input {
  margin-top: 0;
  padding: 12px 13px;
  border-color: rgba(88, 166, 255, 0.28);
  border-radius: 12px;
  background: rgba(1, 4, 9, 0.52);
  font-size: 0.98rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.app-dialog-label .app-rename-input:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow:
    0 0 0 3px rgba(88, 166, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.app-rename-error {
  margin: 10px 0 0;
}

.app-rename-actions {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.app-rename-actions .btn {
  min-width: 104px;
  justify-content: center;
}

/* ── Measure tool panel (Fusion 360-style) ───────────────── */
.measure-card {
  width: min(520px, calc(100vw - 28px));
  max-height: min(86vh, 820px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.measure-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 0;
}

.measure-title-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.measure-title {
  margin: 0 !important;
  font-size: 1rem !important;
}

.measure-card .auth-close {
  top: 12px;
  right: 14px;
}

/* ── Mode toolbar ── */
.measure-pick-toolbar {
  display: flex;
  gap: 6px;
  padding: 12px 20px 0;
  flex-wrap: wrap;
}

.measure-save-btn {
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid rgba(63, 185, 80, 0.45);
  border-radius: 7px;
  background: rgba(63, 185, 80, 0.12);
  color: #3fb950;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.measure-save-btn:hover {
  background: rgba(63, 185, 80, 0.22);
}

.measure-mode-btn {
  flex: 1 1 auto;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.measure-mode-btn:hover {
  border-color: rgba(88, 166, 255, 0.5);
  color: var(--text);
  background: rgba(88, 166, 255, 0.1);
}

.measure-mode-btn.active {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.18);
  color: #58a6ff;
  box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.35);
}

.measure-clear-btn {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.measure-clear-btn:hover {
  border-color: rgba(255, 123, 114, 0.6);
  color: #ff7b72;
}

.measure-hint-text {
  margin: 8px 20px 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Scrollable content area ── */
.measure-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Sections ── */
.measure-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.measure-section-title {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
}

/* ── Selected object stat grid ── */
.measure-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.measure-stat {
  padding: 9px 11px;
  background: var(--surface, #161b22);
}

.measure-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  margin-bottom: 2px;
}

.measure-stat strong {
  display: block;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.measure-center-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  gap: 8px;
}

.measure-center-row strong {
  color: var(--text);
  font-size: 0.78rem;
}

/* ── Picked points ── */
.measure-pick-row {
  display: grid;
  grid-template-columns: 22px auto 1fr;
  align-items: start;
  gap: 6px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
}

.measure-pick-row:last-child { border-bottom: none; }

.measure-pick-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.2);
  color: #58a6ff;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.measure-pick-type {
  color: var(--muted);
  font-size: 0.72rem;
  padding-top: 1px;
}

.measure-pick-coords {
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  grid-column: 2 / -1;
}

.measure-extra {
  display: block;
  grid-column: 2 / -1;
  color: #3fb950;
  font-size: 0.69rem;
  font-family: ui-monospace, monospace;
}

/* ── Distance / angle rows ── */
.measure-dist-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
}

.measure-dist-row:last-child { border-bottom: none; }

.measure-dist-label {
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
}

.measure-dist-value {
  font-size: 1rem;
  font-weight: 700;
  color: #ffd700;
  text-align: center;
  font-family: ui-monospace, monospace;
}

.measure-dist-delta {
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
  font-family: ui-monospace, monospace;
}

/* ── Empty hint ── */
.measure-empty-hint {
  padding: 12px;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.measure-empty-hint strong {
  color: #58a6ff;
}

/* ── Legacy compat ── */
.measure-row, .measure-grid { display: none; }

@media (max-width: 600px) {
  .measure-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .measure-dist-row {
    grid-template-columns: auto 1fr;
  }
  .measure-dist-delta { display: none; }
}

.drop-dest-file {
  margin: 0 0 8px;
  font-size: 0.82rem;
  word-break: break-all;
}

.drop-dest-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.drop-dest-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #161b22;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.drop-dest-option:hover:not(:disabled) {
  border-color: #388bfd;
  background: #21262d;
}

.drop-dest-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.drop-dest-option-title {
  font-size: 0.88rem;
  font-weight: 600;
}

.drop-dest-option-meta {
  font-size: 0.75rem;
}

#drop-destination-new {
  border-color: #388bfd55;
}

.folder-share-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0d1117;
}

.folder-share-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}

.folder-share-item:last-child {
  border-bottom: none;
}

.folder-share-empty {
  padding: 10px;
}

.folder-share-hint {
  margin: 0 0 10px;
}

.folder-share-restrict {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 8px 0;
  cursor: pointer;
}

.folder-share-restrict input {
  margin-top: 2px;
  flex-shrink: 0;
}

.btn-share-remove {
  width: 22px;
  height: 22px;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.workspace-create-row,
.team-invite-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.workspace-create-row {
  margin-top: 4px;
}

.workspace-create-row input {
  padding: 6px 8px;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.82rem;
}

.team-invite-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.team-invite-pick {
  width: 100%;
  padding: 6px 8px;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.82rem;
}

.team-invite-row input {
  padding: 6px 8px;
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.82rem;
}

.profile-workspace-invite {
  flex-wrap: wrap;
}

.profile-workspace-invite .team-invite-pick {
  flex: 1 1 100%;
}

.team-members {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.82rem;
}

.team-members li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
}

.team-members-dropdown {
  border-bottom: none !important;
  padding: 0 !important;
}

.team-members-dropdown details {
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.55);
  overflow: hidden;
}

.team-members-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  list-style: none;
}

.team-members-dropdown summary::-webkit-details-marker {
  display: none;
}

.team-members-dropdown summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.72rem;
  transition: transform 0.15s;
}

.team-members-dropdown details[open] summary::after {
  transform: rotate(180deg);
}

.team-members-list {
  border-top: 1px solid rgba(48, 54, 61, 0.65);
  padding: 4px 8px 7px;
}

.team-member-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.45);
}

.team-member-row:last-child {
  border-bottom: none;
}

.team-member-row strong,
.team-member-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-member-row small {
  color: var(--muted);
  text-transform: capitalize;
}


/* ══════════════════════════════════════════════════════════════════════
   Collapsible panels: left sidebar, ribbon toolbar, activity log
   ══════════════════════════════════════════════════════════════════════ */

/* Allow sidebar grid column to shrink to 0 */
.sidebar.left { min-width: 0; }

/* Smooth grid column animation when sidebar shows/hides */
#app { transition: grid-template-columns 0.22s cubic-bezier(0.4,0,0.2,1); }
#app.left-panel-hidden {
  grid-template-columns: 0px 0px 1fr 6px var(--right-panel-width);
}
#app.right-panel-hidden {
  grid-template-columns: var(--left-panel-width) 6px 1fr 0px 0px;
}
#app.left-panel-hidden.right-panel-hidden {
  grid-template-columns: 0px 0px 1fr 0px 0px;
}
#app.left-panel-hidden .sidebar.left          { overflow: hidden; pointer-events: none; }
#app.left-panel-hidden .panel-gutter-v[data-gutter="left-split"] { pointer-events: none; }
#app.right-panel-hidden .sidebar.right       { overflow: hidden; pointer-events: none; }
#app.right-panel-hidden .panel-gutter-v[data-gutter="right-split"] { pointer-events: none; }

/* Ribbon collapse via max-height */
.ribbon-bar {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.22s cubic-bezier(0.4,0,0.2,1);
}
.ribbon-bar.ribbon-bar--hidden { max-height: 0 !important; }

/* Activity-log collapse (show header row only) */
.left-log-dock { transition: height 0.22s cubic-bezier(0.4,0,0.2,1); }
.left-log-dock.log-dock--collapsed {
  height: 40px !important;
  min-height: 0 !important;
  overflow: hidden;
}

/* ── Sidebar re-open tab (fixed on left edge when sidebar is hidden) ── */
#sidebar-reopen-tab {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 300;
  width: 20px;
  height: 48px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  font-size: 11px;
  padding: 0;
  transition: background 0.12s, color 0.12s;
  box-shadow: 2px 0 6px rgba(0,0,0,0.35);
}
#sidebar-reopen-tab:hover { background: #21262d; color: var(--accent); }
#app.left-panel-hidden ~ #sidebar-reopen-tab,
body.sidebar-hidden #sidebar-reopen-tab { display: flex; }

/* ── Right panel re-open tab ─────────────────────────────────────────── */
#right-panel-reopen-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 300;
  width: 20px;
  height: 48px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  font-size: 11px;
  padding: 0;
  transition: background 0.12s, color 0.12s;
  box-shadow: -2px 0 6px rgba(0,0,0,0.35);
}
#right-panel-reopen-tab:hover { background: #21262d; color: var(--accent); }

/* ── Gutter collapse chevrons ────────────────────────────────────────── */
.gutter-collapse-btn {
  position: absolute;
  z-index: 60;
  width: 18px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #161b22;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.gutter-collapse-btn:hover {
  color: var(--accent);
  background: #21262d;
  border-color: var(--accent);
}

.gutter-collapse-btn--left { left: -6px; }
.gutter-collapse-btn--right { right: -6px; }

#app.left-panel-hidden .gutter-collapse-btn--left { display: none; }
#app.right-panel-hidden .gutter-collapse-btn--right { display: none; }
#app.left-panel-hidden .sidebar-edge-collapse--left { display: none; }

.sidebar-edge-collapse {
  position: absolute;
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
  z-index: 55;
  width: 18px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #161b22;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.sidebar-edge-collapse:hover {
  color: var(--accent);
  background: #21262d;
  border-color: var(--accent);
}

/* ── Collapse toggle buttons ─────────────────────────────────────────── */
.btn-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  flex-shrink: 0;
  white-space: nowrap;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.btn-collapse:hover  { color: var(--text); background: #21262d; }
.btn-collapse[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* ── Activity-log collapse button ────────────────────────────────────── */
#btn-log-collapse {
  padding: 3px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}
#btn-log-collapse:hover { color: var(--text); background: #21262d; }

.gizmo-drag-hud {
  position: absolute;
  z-index: 30;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.82rem;
  font-family: var(--mono);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.fe-mesh-edit { opacity: 0.92; border-style: dashed; }

.right-panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 8px 4px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel);
}

.right-panel-tab {
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 0.76rem;
  cursor: pointer;
}

.right-panel-tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: #1f6feb22;
}

.right-tab-panel { display: none; }
.right-tab-panel.active { display: block; }

/* Prompt AI panels — fill sidebar to the bottom */
.prompt-panel.right-tab-panel.active,
.wiring-prompt-panel.right-tab-panel.active,
.rigging-prompt-panel.right-tab-panel.active,
.electronics-panel.right-tab-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

.edit-panel.right-tab-panel.active,
.feature-history-panel.right-tab-panel.active,
.reference-panel.right-tab-panel.active,
.sketch-inspector.right-tab-panel.active {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.architect-prompt-panel.right-tab-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  overflow: hidden;
}

.right-panel-tabs,
.project-cost-thumb {
  flex-shrink: 0;
}

.panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.feature-history-collapsed #feature-editor,
.feature-history-collapsed .feature-history-section > p,
.feature-history-collapsed .project-history-section {
  display: none;
}

.feature-history-panel {
  min-width: 0;
  overflow-x: hidden;
}

.feature-history-panel h2,
.feature-editor-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feature-editor {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-editor-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.feature-editor-status {
  line-height: 1.35;
}

.fe-part-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fe-feature {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(48, 54, 61, 0.75);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.45);
}

.fe-feature-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}

.fe-feature-title {
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fe-feature-actions {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}

.fe-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0d1117;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
}

.fe-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
}

.fe-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.fe-params {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.fe-param {
  display: grid;
  grid-template-columns: minmax(58px, 0.55fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.fe-param-label {
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fe-input,
.fe-input-vec {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #0d1117;
  color: var(--text);
  font-size: 0.78rem;
}

.fe-param-vec {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

.fe-param-unit {
  color: var(--muted);
  font-size: 0.72rem;
  min-width: 20px;
}

.fe-param-static {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #c9d1d9;
  font-size: 0.78rem;
}

.marking-menu {
  position: fixed;
  z-index: 1000;
  width: 420px;
  height: 420px;
  margin-left: -210px;
  margin-top: -210px;
  border-radius: 50%;
  pointer-events: none;
}

.marking-menu button {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 88px;
  height: 58px;
  margin-left: -44px;
  margin-top: -29px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.96);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.marking-menu button:hover {
  border-color: var(--accent);
  background: #1f6feb33;
}

.marking-menu button span { font-size: 1.05rem; line-height: 1; }
.marking-menu button small { font-size: 0.63rem; color: var(--muted); }
.marking-menu button:nth-child(1) { transform: translate(0, -154px); }
.marking-menu button:nth-child(2) { transform: translate(77px, -133px); }
.marking-menu button:nth-child(3) { transform: translate(133px, -77px); }
.marking-menu button:nth-child(4) { transform: translate(154px, 0); }
.marking-menu button:nth-child(5) { transform: translate(133px, 77px); }
.marking-menu button:nth-child(6) { transform: translate(77px, 133px); }
.marking-menu button:nth-child(7) { transform: translate(0, 154px); }
.marking-menu button:nth-child(8) { transform: translate(-77px, 133px); }
.marking-menu button:nth-child(9) { transform: translate(-133px, 77px); }
.marking-menu button:nth-child(10) { transform: translate(-154px, 0); }
.marking-menu button:nth-child(11) { transform: translate(-133px, -77px); }
.marking-menu button:nth-child(12) { transform: translate(-77px, -133px); }

/* Direct modeling HUD + gizmo panel */
.client-update-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(88, 166, 255, 0.45);
  background: rgba(22, 27, 34, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: #e6edf3;
  font-size: 0.82rem;
}
.client-update-banner.hidden { display: none; }
.client-update-banner span {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
}

.floating-panel {
  position: absolute;
  z-index: 30;
  width: min(300px, calc(100% - 24px));
  padding: 12px 14px;
  padding-top: 10px;
  padding-right: 28px;
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  font-size: 0.82rem;
  user-select: none;
}
.floating-panel-grip {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.floating-panel-grip:hover {
  color: var(--accent);
  background: rgba(88, 166, 255, 0.14);
}
.floating-panel--dragging .floating-panel-grip {
  cursor: grabbing;
}
.floating-panel--dragging {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.62);
  border-color: var(--accent);
  cursor: grabbing;
}
.dm-hud-title { font-weight: 600; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.dm-hud-hint { font-weight: 400; font-size: 0.68rem; color: var(--muted); }
.dm-hud-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.dm-hud-row label { color: var(--muted); font-size: 0.74rem; }
.dm-hud-row input[type="text"], .dm-hud-row select {
  width: 100%; padding: 4px 8px; border-radius: 4px;
  border: 1px solid var(--border); background: #0d1117; color: var(--text); font-size: 0.8rem;
}
.dm-hud-row-hidden { display: none; }
.dm-hud-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }

/* ── Fillet / Chamfer drag scrubber ────────────────────────────────── */
.dm-fc-scrub-row { grid-template-columns: 72px 1fr; }
.dm-fc-scrub {
  display: flex; align-items: center; gap: 4px;
  background: #161b22; border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px; cursor: ew-resize;
  transition: border-color 0.15s;
}
.dm-fc-scrub:hover { border-color: var(--accent); }
.dm-fc-scrub--dragging { border-color: var(--accent); background: #1f6feb22; cursor: grabbing; }
.dm-fc-scrub-icon {
  font-size: 0.75rem; color: var(--muted); flex-shrink: 0;
  pointer-events: none; user-select: none;
}
.dm-fc-scrub input[type="text"] {
  width: 52px; padding: 3px 4px; border: none; background: transparent;
  color: var(--text); font-size: 0.82rem; text-align: right; cursor: text;
  outline: none;
}
.dm-fc-scrub input[type="text"]:focus { background: #0d1117; border-radius: 3px; }
.dm-fc-scrub .dm-hud-unit { font-size: 0.72rem; color: var(--muted); pointer-events: none; }
.dm-fc-preview-status {
  font-size: 0.72rem; min-height: 14px; margin: 4px 0 2px; text-align: right;
}
.dm-fc-preview--loading { color: var(--muted); }
.dm-fc-preview--ok      { color: #3fb950; }
.dm-fc-preview--err     { color: #f85149; }
.dm-hud-btns { display: flex; gap: 4px; }
.dm-plane-btn.active { border-color: var(--accent); color: var(--accent); }
.direct-tools-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.direct-tool-btn.active { border-color: var(--accent); background: #1f6feb22; }

.gizmo-panel {
  position: absolute; z-index: 20;
  width: min(280px, calc(100% - 24px)); padding: 10px 12px;
  padding-top: 8px;
  padding-right: 26px;
  border-radius: 8px; background: rgba(13, 17, 23, 0.96);
  border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  user-select: none;
}
.dm-hud-row input[type="text"], .dm-hud-row select,
.gizmo-panel-fields input {
  user-select: text;
}
.gizmo-panel.hidden { display: none; }
.gizmo-panel-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 8px; font-size: 0.85rem; }
.gizmo-panel-modes { display: flex; gap: 2px; margin-left: auto; }
.gizmo-panel-modes button, .gizmo-panel-space, .gizmo-panel-button-group button {
  padding: 2px 8px; font-size: 0.72rem; border-radius: 4px;
  border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer;
}
.gizmo-panel-modes button.active, .gizmo-panel-button-group button.active { border-color: var(--accent); color: var(--accent); background: #1f6feb22; }
.gizmo-panel-fields { display: flex; flex-direction: column; gap: 5px; margin-bottom: 6px; }
.gizmo-panel-fields label { display: grid; grid-template-columns: 16px 1fr auto; gap: 6px; align-items: center; font-size: 0.78rem; }
.gizmo-panel-fields input { padding: 3px 6px; border-radius: 4px; border: 1px solid var(--border); background: #0d1117; color: var(--text); }
.gizmo-panel-row {
  display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center;
  margin: 6px 0; font-size: 0.76rem; color: var(--muted);
}
.gizmo-panel-row select {
  min-width: 0; padding: 3px 6px; border-radius: 4px;
  border: 1px solid var(--border); background: #0d1117; color: var(--text);
}
.gizmo-panel-button-group { display: flex; gap: 4px; }
.gizmo-panel-button-group button { flex: 1; }
.gizmo-panel-actions { display: flex; justify-content: flex-end; gap: 6px; }
.gizmo-panel-color { margin-right: auto; }
.gizmo-panel-status { margin-top: 6px; font-size: 0.7rem; }
.gizmo-panel-status.error { color: #f85149; }
.gizmo-panel-status.loading { color: var(--accent); }
.gizmo-panel-status.warn { color: #d29922; }

.mesh-checkup-panel { width: min(320px, calc(100% - 24px)); }
.mesh-checkup-options { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.mesh-checkup-opt { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text); }
.mesh-checkup-opt select, .mesh-checkup-opt input[type="number"] {
  margin-left: auto; padding: 3px 6px; border-radius: 4px;
  border: 1px solid var(--border); background: #0d1117; color: var(--text);
}
.mesh-checkup-results { margin: 8px 0; max-height: 220px; overflow-y: auto; }
.mesh-checkup-stats { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; }
.mesh-checkup-issues { margin: 0; padding-left: 18px; font-size: 0.76rem; color: #f85149; }
.mesh-checkup-ok { margin: 0; font-size: 0.76rem; color: var(--accent2); }
.mesh-checkup-selection { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 0.76rem; }
.mesh-checkup-warn .mesh-checkup-stats { color: #d29922; }

/* ── Section View HUD panel ─────────────────────────────────────────────── */
.section-view-panel {
  position: fixed;
  top: 56px;
  right: 16px;
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  padding: 0;
  z-index: 800;
  display: none;
  flex-direction: column;
  gap: 0;
  font-size: 0.78rem;
  color: var(--text);
}
.section-view-panel.sv-visible { display: flex; }

.sv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
}
.sv-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.sv-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.sv-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.sv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
}
.sv-row:last-of-type { border-bottom: none; }

.sv-label {
  min-width: 48px;
  color: var(--muted);
  font-size: 0.73rem;
}

.sv-axis-btns { display: flex; gap: 4px; }
.sv-axis-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  width: 28px;
  height: 24px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.sv-axis-btn:hover { background: rgba(88,166,255,0.12); color: var(--text); }
.sv-axis-btn.sv-axis-active {
  background: rgba(88,166,255,0.18);
  border-color: var(--accent);
  color: var(--accent);
}

.sv-slider {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
.sv-pct {
  min-width: 30px;
  text-align: right;
  color: var(--muted);
  font-size: 0.72rem;
}

.sv-flip-btn, .sv-reset-btn {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.73rem;
  padding: 4px 0;
  cursor: pointer;
  transition: background 0.12s;
}
.sv-flip-btn:hover, .sv-reset-btn:hover { background: rgba(88,166,255,0.12); }

.sv-hint {
  padding: 5px 10px 7px;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ── Component profile popup ─────────────────────────────────────────────── */
.comp-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 9, 0.7);
  backdrop-filter: blur(3px);
}
.comp-profile-overlay.hidden { display: none; }
.comp-profile-modal {
  width: min(880px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.comp-profile-head,
.comp-profile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.comp-profile-foot { border-bottom: none; border-top: 1px solid var(--border); gap: 12px; }
.comp-profile-foot-actions { display: flex; gap: 8px; }
.comp-profile-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}
.comp-profile-close:hover { color: var(--text); }
.comp-profile-head-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.comp-profile-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.comp-profile-tags.hidden { display: none; }
.comp-profile-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.68rem;
  color: var(--muted);
  background: rgba(110, 118, 129, 0.12);
  border: 1px solid rgba(110, 118, 129, 0.25);
  border-radius: 999px;
  padding: 2px 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comp-profile-type-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #58a6ff;
  background: rgba(31, 111, 235, 0.16);
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
}
.comp-profile-type-tag.hidden { display: none; }
.comp-profile-type-tag--sourced {
  color: #3fb950;
  background: rgba(46, 160, 67, 0.14);
  border-color: rgba(63, 185, 80, 0.35);
}
.comp-profile-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  padding: 16px;
  overflow: auto;
}
.comp-profile-viewer {
  width: 100%;
  height: 240px;
  border-radius: 10px;
  overflow: hidden;
  background: #0d1117;
  border: 1px solid var(--border);
}
.comp-profile-source-preview { margin-top: 10px; }
.comp-profile-source-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  margin-top: 4px;
}
.comp-profile-section { margin-bottom: 16px; }
.comp-profile-section h4 { margin: 0 0 8px; font-size: 0.82rem; }
.comp-profile-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.82rem;
}
.comp-profile-field > span:first-child { color: var(--muted); min-width: 110px; }
.comp-profile-field input,
.comp-profile-field select {
  flex: 1;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
}
.comp-profile-kind { font-weight: 600; }
.comp-profile-stats-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.comp-profile-stats-table th,
.comp-profile-stats-table td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.comp-profile-stats-table th { color: var(--muted); font-weight: 500; width: 45%; }
.comp-profile-search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.comp-profile-search {
  flex: 1;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 9px;
}
.comp-profile-results { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.comp-profile-result {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
}
.comp-profile-result-thumb {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comp-profile-result-thumb img { max-width: 100%; max-height: 100%; }
.comp-profile-result-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.comp-profile-result-main strong { font-size: 0.82rem; }
.comp-profile-linked { margin-top: 10px; font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.comp-profile-linked a { color: var(--accent, #58a6ff); }
.comp-profile-import-step { margin-left: 2px; }
.comp-profile-status.ok { color: #3fb950; }
.comp-profile-status.error { color: #f85149; }
@media (max-width: 640px) {
  .comp-profile-body { grid-template-columns: 1fr; }
}

/* Explorer profile button + sourced badge */
.browser-action-profile {
  color: var(--accent, #58a6ff);
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(88, 166, 255, 0.45);
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}
.browser-item-badge--sourced {
  background: rgba(63, 185, 80, 0.18);
  border-color: rgba(63, 185, 80, 0.5);
  color: #3fb950;
}

/* Workspace explorer component rows: badge + profile button + drag affordance */
.proj-hierarchy-item--component { display: flex; align-items: center; gap: 4px; min-width: 0; }
.proj-hierarchy-item--component .proj-hierarchy-item-btn { flex: 1 1 auto; min-width: 0; cursor: grab; }
.proj-hierarchy-item--component .proj-hierarchy-item-btn:active { cursor: grabbing; }
.proj-hierarchy-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.14);
  border: 1px solid rgba(88, 166, 255, 0.4);
}
.proj-hierarchy-badge--sourced {
  color: #3fb950;
  background: rgba(63, 185, 80, 0.16);
  border-color: rgba(63, 185, 80, 0.5);
}
.proj-hierarchy-profile-btn {
  flex: 0 0 auto;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--accent, #58a6ff);
  font-size: 0.85rem;
  line-height: 1;
  padding: 3px 6px;
  cursor: pointer;
  opacity: 1;
}
.proj-hierarchy-item--component:hover .proj-hierarchy-profile-btn { opacity: 1; }
.proj-hierarchy-profile-btn:hover {
  border-color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.12);
}

/* Driver chip visual on the wiring canvas */
.wiring-vis-driver {
  position: absolute;
  inset: 6px;
  border-radius: 5px;
  background: linear-gradient(160deg, #2b3138, #14171b);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 2px 4px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wiring-vis-driver-chip {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffd479;
}

.wiring-vis-driver--stepdir {
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
}

.wiring-driver-header-grid {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(1, 4, 9, 0.2);
}

.wiring-driver-grid-box {
  position: absolute;
  left: 10.5%;
  top: 21%;
  width: 47%;
  height: 54%;
  border: 1px solid rgba(88, 166, 255, 0.42);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(88, 166, 255, 0.08), rgba(1, 4, 9, 0.02));
}

.wiring-driver-grid-line {
  position: absolute;
  background: rgba(88, 166, 255, 0.22);
  pointer-events: none;
}

.wiring-driver-grid-line--v1,
.wiring-driver-grid-line--v2 {
  top: 21%;
  width: 1px;
  height: 54%;
}
.wiring-driver-grid-line--v1 { left: 26%; }
.wiring-driver-grid-line--v2 { left: 42%; }
.wiring-driver-grid-line--h1,
.wiring-driver-grid-line--h2 {
  left: 10.5%;
  width: 47%;
  height: 1px;
}
.wiring-driver-grid-line--h1 { top: 39%; }
.wiring-driver-grid-line--h2 { top: 57%; }

.wiring-driver-col-label,
.wiring-driver-row-label,
.wiring-driver-ms-label,
.wiring-driver-motor-label {
  position: absolute;
  z-index: 1;
  color: #c9d1d9;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.wiring-driver-col-label {
  top: 20%;
  transform: translateX(-50%);
  color: #79c0ff;
}

.wiring-driver-row-label {
  left: 3%;
  width: 11%;
  transform: translateY(-50%);
  text-align: right;
}

.wiring-driver-ms-label {
  left: 9%;
  bottom: 3%;
  color: #79c0ff;
}

.wiring-driver-motor-label {
  right: 4%;
  top: 9%;
  color: #ffd479;
  font-size: 8px;
}

.wiring-driver-chip--stepdir {
  position: absolute;
  left: 61%;
  top: 44%;
  transform: translateY(-50%);
}

/* "Add driver" fix button in the wiring check panel */
.wiring-check-fix {
  margin-top: 6px;
  font-size: 0.72rem;
  padding: 4px 9px;
}

/* Driver picker popup */
.driver-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 4100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 9, 0.7);
  backdrop-filter: blur(3px);
}
.driver-picker-overlay.hidden { display: none; }
.driver-picker-modal {
  width: min(620px, 94vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  padding: 0 0 14px;
}
.driver-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.driver-picker-close { background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; }
.driver-picker-intro { padding: 10px 16px 0; }
.driver-picker-recommended, .driver-picker-section { padding: 10px 16px 0; }
.driver-picker-recommended h4, .driver-picker-section h4 { margin: 6px 0; font-size: 0.82rem; }
.driver-picker-builtins { display: flex; flex-direction: column; gap: 8px; }
.driver-picker-builtin {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
}
.driver-picker-builtin--primary { border-color: var(--accent, #58a6ff); box-shadow: 0 0 0 1px rgba(88,166,255,0.3); }
.driver-picker-builtin-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.driver-picker-builtin-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.driver-picker-builtin-actions .btn { white-space: nowrap; }
.driver-picker-visual {
  position: relative;
  width: 82px;
  height: 58px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background:
    radial-gradient(circle at 18px 16px, rgba(255,255,255,0.18) 0 3px, transparent 4px),
    linear-gradient(145deg, #147d46, #0f5132);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 6px 16px rgba(0,0,0,0.28);
  overflow: hidden;
}
.driver-picker-visual--a4988 {
  background:
    radial-gradient(circle at 14px 14px, rgba(255,255,255,0.18) 0 3px, transparent 4px),
    linear-gradient(145deg, #9f1239, #57111f);
}
.driver-picker-visual--l298n {
  background:
    radial-gradient(circle at 14px 14px, rgba(255,255,255,0.2) 0 3px, transparent 4px),
    linear-gradient(145deg, #2563eb, #1e3a8a);
}
.driver-chip {
  position: absolute;
  left: 26px;
  top: 17px;
  width: 30px;
  height: 20px;
  border-radius: 4px;
  background: #111827;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.driver-terminal {
  position: absolute;
  top: 8px;
  width: 10px;
  height: 42px;
  border-radius: 2px;
  background: #d97706;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.driver-terminal--left { left: 8px; }
.driver-terminal--right { right: 8px; }
.driver-pins {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 7px;
  height: 5px;
  background: repeating-linear-gradient(90deg, #cbd5e1 0 3px, transparent 3px 7px);
  opacity: 0.95;
}
.driver-picker-specs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.driver-picker-specs span {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(139,148,158,0.24);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.68rem;
}
.driver-picker-more { margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(139,148,158,0.18); }
.driver-picker-more.hidden { display: none; }
.driver-picker-more dl { margin: 0; display: grid; gap: 5px; }
.driver-picker-more div { display: grid; grid-template-columns: 50px 1fr; gap: 8px; }
.driver-picker-more dt { color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.driver-picker-more dd { margin: 0; color: var(--text); font-size: 0.72rem; line-height: 1.35; }
.driver-picker-search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.driver-picker-search {
  flex: 1;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 9px;
}
.driver-picker-results { display: flex; flex-direction: column; gap: 8px; }
.driver-picker-result {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
}
.driver-picker-thumb {
  width: 48px; height: 48px; border-radius: 6px; background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.driver-picker-thumb img { max-width: 100%; max-height: 100%; }
.driver-picker-result-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.driver-picker-result-actions { display: flex; flex-direction: column; gap: 5px; }
.driver-picker-result-actions .btn { font-size: 0.72rem; padding: 4px 8px; text-align: center; text-decoration: none; }
.driver-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 0;
}
.driver-picker-status.ok { color: #3fb950; }
.driver-picker-status.error { color: #f85149; }

@media (max-width: 680px) {
  .driver-picker-builtin {
    grid-template-columns: 70px minmax(0, 1fr);
  }
  .driver-picker-visual {
    width: 66px;
    height: 50px;
  }
  .driver-picker-builtin-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }
  .driver-picker-result {
    grid-template-columns: 48px 1fr;
  }
  .driver-picker-result-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }
}

/* Wiring part realistic photo + 3D button */
.wiring-part--photo { overflow: hidden; }
.wiring-part-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.9;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: inherit;
}
.wiring-part--photo .wiring-part-label {
  position: relative;
  z-index: 2;
  background: rgba(13, 17, 23, 0.78);
  padding: 1px 5px;
  border-radius: 4px;
}
.wiring-part-3d {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 3;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
  border: 1px solid var(--accent, #58a6ff);
  background: rgba(13, 17, 23, 0.85);
  color: var(--accent, #58a6ff);
  cursor: pointer;
}
.wiring-part-3d:hover { background: var(--accent, #58a6ff); color: #0d1117; }

/* Wiring 3D preview overlay */
.wiring-3d-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 4, 9, 0.7);
}
.wiring-3d-overlay.hidden { display: none; }
.wiring-3d-modal {
  width: min(560px, 90%);
  background: var(--panel, #161b22);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.wiring-3d-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.wiring-3d-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
.wiring-3d-stage { width: 100%; height: 340px; background: #0d1117; }
.wiring-3d-foot { padding: 8px 14px; border-top: 1px solid var(--border); }

#ribbon-desktop-anchor {
  grid-area: ribbon;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#ribbon-container {
  grid-area: unset;
  flex: 1;
  min-height: 0;
  overflow: visible;
}

.prompt-speed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.72);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.prompt-speed-toggle select {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.prompt-codex-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  z-index: 5;
}

.prompt-codex-wrap.hidden {
  display: none;
}

.prompt-codex-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.72);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.prompt-codex-toggle input {
  margin: 0;
  accent-color: #f59e0b;
  cursor: pointer;
}

.prompt-codex-toggle:has(input:checked) {
  border-color: rgba(245, 158, 11, 0.7);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
}

.prompt-codex-tip {
  border-color: rgba(245, 158, 11, 0.4);
  background:
    linear-gradient(165deg, rgba(48, 36, 16, 0.98) 0%, rgba(16, 14, 10, 0.98) 100%);
}

.prompt-codex-tip::after {
  border-right-color: rgba(245, 158, 11, 0.4);
  border-bottom-color: rgba(245, 158, 11, 0.4);
  background: rgba(28, 22, 12, 0.98);
}

.prompt-codex-tip-badge {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.35);
}

.prompt-spice-tip {
  position: fixed;
  left: 0;
  top: 0;
  width: min(280px, 72vw);
  padding: 12px 13px 11px;
  border-radius: 12px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background:
    linear-gradient(165deg, rgba(22, 36, 58, 0.98) 0%, rgba(10, 16, 28, 0.98) 100%);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  color: #e6edf3;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(calc(-100% + 6px)) scale(0.98);
  transition:
    opacity 90ms ease,
    transform 110ms ease,
    visibility 0s linear 70ms;
  z-index: 12000;
}

.prompt-spice-tip.prompt-spice-tip--measure {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: none !important;
}

.prompt-spice-tip::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(88, 166, 255, 0.35);
  border-bottom: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(12, 20, 34, 0.98);
  transform: rotate(45deg);
}

.prompt-spice-tip.prompt-spice-tip--below {
  transform: translateY(-6px) scale(0.98);
}

.prompt-spice-tip.prompt-spice-tip--below::after {
  top: -6px;
  bottom: auto;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid rgba(88, 166, 255, 0.35);
  border-top: 1px solid rgba(88, 166, 255, 0.35);
}

.prompt-spice-tip.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-100%) scale(1);
  transition-delay: 0s, 0s, 0s;
}

.prompt-spice-tip.prompt-spice-tip--below.is-visible {
  transform: translateY(0) scale(1);
}

.prompt-spice-tip-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 7px;
}

.prompt-spice-tip-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 139, 253, 0.18);
  border: 1px solid rgba(88, 166, 255, 0.4);
  color: #79c0ff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prompt-spice-tip-title {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
  color: #f0f6fc;
}

.prompt-spice-tip-body {
  margin: 0 0 8px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: rgba(201, 209, 217, 0.92);
}

.prompt-spice-tip-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.prompt-spice-tip-list li {
  position: relative;
  padding-left: 12px;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(139, 148, 158, 0.98);
}

.prompt-spice-tip-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #58a6ff;
  box-shadow: 0 0 0 2px rgba(56, 139, 253, 0.2);
}

.prompt-spice-compare-card {
  width: min(760px, 100%);
}

.prompt-spice-compare-note {
  margin: -4px 0 12px;
}

.prompt-spice-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.prompt-spice-compare-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-spice-compare-heading {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.prompt-spice-compare-pane--improved .prompt-spice-compare-heading {
  color: #79c0ff;
}

.prompt-spice-compare-text {
  margin: 0;
  padding: 10px 12px;
  min-height: 120px;
  max-height: min(42vh, 360px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.prompt-spice-compare-pane--improved .prompt-spice-compare-text {
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(56, 139, 253, 0.08);
}

@media (max-width: 720px) {
  .prompt-spice-compare-grid {
    grid-template-columns: 1fr;
  }
}

.prompt-skills-trail {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.prompt-kb-icon-wrap {
  position: relative;
  flex-shrink: 0;
}

.prompt-skills-row .prompt-mic-btn {
  margin-left: 0;
}

.prompt-kb-icon-btn {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.prompt-kb-icon-btn:hover,
.prompt-kb-icon-btn[aria-expanded="true"] {
  color: var(--text);
  background: rgba(88, 166, 255, 0.12);
}

.prompt-kb-icon-btn.is-on {
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.14);
}

.prompt-kb-icon-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #1f6feb;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.prompt-kb-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: min(420px, 92vw);
  max-height: min(72vh, 640px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0d1117;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}

.prompt-kb-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.prompt-kb-popover-head strong {
  font-size: 0.86rem;
  display: block;
}

.prompt-kb-popover-sub {
  margin: 2px 0 0;
  font-size: 0.7rem;
  line-height: 1.3;
}

.prompt-kb-drop,
.kb-modal-drop {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding: 12px 10px;
  border: 1px dashed rgba(88, 166, 255, 0.4);
  border-radius: 10px;
  background: rgba(56, 139, 253, 0.06);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.prompt-kb-drop strong,
.kb-modal-drop strong {
  font-size: 0.78rem;
  color: var(--text);
}

.prompt-kb-drop span,
.kb-modal-drop span {
  font-size: 0.68rem;
  line-height: 1.35;
}

.prompt-kb-drop:hover,
.kb-modal-drop:hover,
.prompt-kb-drop.is-dragover,
.kb-modal-drop.is-dragover,
.prompt-kb-popover.is-dragover,
.kb-modal-card.is-dragover {
  border-color: #58a6ff;
  background: rgba(56, 139, 253, 0.14);
  color: var(--text);
}

.prompt-kb-drop.is-uploading,
.kb-modal-drop.is-uploading {
  opacity: 0.7;
  pointer-events: none;
}

.prompt-kb-overview {
  margin-bottom: 10px;
}

.prompt-kb-selected-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--muted);
}

.prompt-kb-selected-summary em {
  font-style: normal;
  color: #79c0ff;
  font-weight: 700;
}

.prompt-kb-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.prompt-kb-pick-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.prompt-kb-pick-item:hover,
.prompt-kb-pick-item.is-selected {
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(56, 139, 253, 0.08);
}

.prompt-kb-pick-item input {
  margin-top: 3px;
  accent-color: #58a6ff;
}

.prompt-kb-pick-body {
  all: unset;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
  color: inherit;
  text-align: left;
}

.prompt-kb-pick-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.prompt-kb-pick-title strong {
  font-size: 0.84rem;
  font-weight: 650;
}

.prompt-kb-pick-desc {
  font-size: 0.72rem;
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
}

.prompt-kb-card-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-kb-metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.7rem;
  color: var(--muted);
}

.prompt-kb-metric-row em {
  font-style: normal;
  color: var(--text);
  font-weight: 700;
}

.prompt-kb-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.68rem;
  color: var(--muted);
}

.kb-stats--compact {
  padding: 10px;
}

.kb-stats--compact .kb-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kb-stats-largest {
  margin: 8px 0 0;
}

.kb-detail-stats {
  margin-top: 10px;
}

.prompt-kb-status {
  margin: 8px 0 0;
}

.prompt-kb-status.error {
  color: #ff7b72;
}

body.kb-modal-open {
  overflow: hidden;
}

.kb-site-modal {
  z-index: 12000;
  padding: clamp(12px, 2vw, 28px);
  align-items: stretch;
  justify-content: center;
}

.kb-site-modal .auth-backdrop {
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(8px);
}

.kb-modal-card {
  width: min(1280px, 96vw);
  height: min(920px, 92vh);
  max-height: min(920px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px 24px 20px;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.kb-modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-right: 36px;
}

.kb-modal-top .app-dialog-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.kb-modal-top .muted {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  max-width: 52ch;
}

.kb-modal-overview,
.kb-overview-stats,
.prompt-kb-drop,
.prompt-kb-status {
  flex-shrink: 0;
}

.kb-modal-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.45fr);
  gap: 18px;
  margin-top: 12px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.kb-modal-side,
.kb-modal-main {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.kb-modal-picker {
  flex: 1;
  min-height: 0;
  overflow: auto;
  max-height: none;
}

.prompt-kb-pick-item.is-active {
  border-color: rgba(88, 166, 255, 0.7);
  background: rgba(56, 139, 253, 0.14);
  box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.25);
}

.kb-create-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.kb-create-row input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.55);
  color: var(--text);
}

.kb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  margin-bottom: 10px;
}

.kb-list-item {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kb-list-item.active,
.kb-list-item:hover {
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(56, 139, 253, 0.1);
}

.kb-list-item span,
.kb-list-item em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

.kb-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.kb-detail-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}

.prompt-kb-section-label,
.kb-list-section {
  margin: 8px 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.kb-shared-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(210, 168, 255, 0.45);
  color: #d2a8ff;
  font-size: 0.62rem;
  font-weight: 700;
  vertical-align: middle;
}

.prompt-kb-pick-item.is-shared,
.kb-list-item--shared {
  border-color: rgba(210, 168, 255, 0.28);
}

.kb-share-panel {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 10px;
  background: rgba(1, 4, 9, 0.22);
}

.kb-share-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.kb-share-form {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.kb-share-form select {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.75);
  color: var(--text);
  padding: 6px 8px;
  font-size: 0.78rem;
}

.kb-share-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kb-share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}

.kb-share-row em {
  font-style: normal;
  color: var(--muted);
  margin-left: 6px;
}

.kb-share-readonly {
  padding: 8px 0;
}

@media (max-width: 720px) {
  .kb-share-form {
    grid-template-columns: 1fr;
  }
}


.kb-stats {
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 12px;
  padding: 12px;
  background: rgba(1, 4, 9, 0.28);
}

.kb-stats-head {
  margin-bottom: 10px;
  font-size: 0.84rem;
}

.kb-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.kb-stats-grid article {
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.kb-stats-grid span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.kb-stats-grid strong {
  font-size: 0.95rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-stats-grid small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.kb-stats-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.kb-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  font-size: 0.72rem;
  color: var(--muted);
}

.kb-stat-pill em {
  font-style: normal;
  color: var(--text);
  font-weight: 700;
}

.kb-stat-pill--text { border-color: rgba(88, 166, 255, 0.35); }
.kb-stat-pill--cad { border-color: rgba(63, 185, 80, 0.35); }
.kb-stat-pill--image { border-color: rgba(210, 168, 255, 0.35); }
.kb-stat-pill--pdf { border-color: rgba(255, 123, 114, 0.35); }

.kb-stats-formats {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kb-format-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.kb-format-row i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #58a6ff, #3fb950);
}

.kb-format-row em {
  font-style: normal;
  text-align: right;
  color: var(--text);
}

.kb-list-cats {
  font-size: 0.68rem !important;
}

.kb-skills {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.22);
}

.kb-skills-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.kb-skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.kb-skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
}

.kb-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.kb-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.kb-crumb {
  border: none;
  background: transparent;
  color: #79c0ff;
  cursor: pointer;
  padding: 0;
}

.kb-tree-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow: auto;
}

.kb-folder-card,
.kb-item-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
}

.kb-folder-card {
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.kb-item-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.kb-item-card span,
.kb-item-card p {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  margin: 4px 0 0;
}

.kb-item-card p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

@media (max-width: 900px) {
  .kb-modal-card {
    width: 96vw;
    height: 94vh;
    max-height: 94vh;
    padding: 16px;
  }

  .kb-modal-top {
    flex-direction: column;
    align-items: stretch;
    padding-right: 28px;
  }

  .kb-modal-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .kb-modal-side,
  .kb-modal-main {
    overflow: visible;
  }
}

.codex-openai-key-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
  max-height: min(40vh, 280px);
  overflow: auto;
}

.codex-openai-key-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
}

.codex-openai-key-option:has(input:checked) {
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(245, 158, 11, 0.1);
}

.codex-openai-key-option input {
  margin-top: 3px;
  accent-color: #f59e0b;
}

.codex-openai-key-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.codex-openai-key-option-body strong {
  font-size: 0.92rem;
  color: #e6edf3;
}

.prompt-mode-btn--fusion {
  border-color: rgba(0, 120, 212, 0.45);
}

.prompt-mode-btn--fusion:hover:not(.active) {
  border-color: #0099ff;
  color: #7dd3fc;
  background: rgba(0, 153, 255, 0.08);
}

.prompt-mode-btn--fusion.active {
  border-color: #0099ff;
  color: #fff;
  background: linear-gradient(135deg, rgba(0, 120, 212, 0.35), rgba(0, 180, 216, 0.25));
}

.prompt-mode-btn--electronics {
  border-color: rgba(16, 185, 129, 0.35);
  letter-spacing: 0.01em;
}

.prompt-mode-btn--electronics:hover:not(.active) {
  border-color: rgba(52, 211, 153, 0.65);
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.08);
}

.prompt-mode-btn--electronics.active {
  border-color: rgba(52, 211, 153, 0.75);
  color: #ecfdf5;
  background: rgba(16, 185, 129, 0.22);
}

.prompt-electronics-tip {
  border-color: rgba(52, 211, 153, 0.42);
  z-index: 12050;
}

.prompt-electronics-tip::after {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(8, 24, 20, 0.98);
}

.prompt-electronics-tip-badge {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.35);
}

.prompt-skills-plan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: -2px 0 8px;
  padding: 7px 8px;
  border: 1px solid rgba(56, 139, 253, 0.18);
  border-radius: 10px;
  background: rgba(56, 139, 253, 0.06);
}

.skill-chip--planned {
  border-color: rgba(56, 139, 253, 0.35);
  background: rgba(56, 139, 253, 0.12);
}

.architect-mode-tab {
  display: inline-flex;
}

.architect-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.architect-phase-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ecbff;
  background: rgba(88, 166, 255, 0.18);
  border: 1px solid rgba(88, 166, 255, 0.35);
}

.architect-phase-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 12px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.architect-phase-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 12px;
}

.architect-phase-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #8b949e);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.architect-phase-tab:hover {
  color: var(--text, #e6edf3);
  background: rgba(255, 255, 255, 0.04);
}

.architect-phase-tab.active {
  color: #e6edf3;
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(88, 166, 255, 0.18);
}

.architect-phase-tab[data-architect-phase]:not([data-architect-phase="build"]):not(.active) {
  opacity: 0.85;
}

.architect-phase-lead {
  margin: 0 0 10px;
  line-height: 1.4;
}

.architect-phase-pane[hidden] {
  display: none !important;
}

.architect-domino-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(88, 166, 255, 0.08);
}

.architect-domino-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.architect-tile-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.architect-tile-btn {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  cursor: pointer;
  text-align: center;
}

.architect-tile-btn:hover {
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(88, 166, 255, 0.1);
}

.architect-tile-btn.active {
  border-color: rgba(88, 166, 255, 0.75);
  background: rgba(88, 166, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.25);
}

.architect-tile-preview {
  width: 44px;
  height: 36px;
  border-radius: 4px;
  border: 1.5px solid rgba(230, 237, 243, 0.55);
  background: rgba(230, 237, 243, 0.08);
  position: relative;
}

.architect-tile-preview--wall {
  background: linear-gradient(180deg, rgba(180, 190, 200, 0.35), rgba(120, 130, 140, 0.2));
}

.architect-tile-preview--door::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 14px;
  height: 22px;
  transform: translateX(-50%);
  border: 1.5px solid rgba(230, 237, 243, 0.7);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  background: rgba(20, 24, 30, 0.55);
}

.architect-tile-preview--window::before,
.architect-tile-preview--window::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 12px;
  height: 14px;
  border: 1.5px solid rgba(140, 200, 255, 0.85);
  background: rgba(88, 166, 255, 0.18);
}

.architect-tile-preview--window::before {
  left: 7px;
}

.architect-tile-preview--window::after {
  right: 7px;
}

.architect-tile-label {
  font-size: 0.78rem;
  font-weight: 700;
}

.architect-tile-desc {
  font-size: 0.64rem;
  color: var(--muted, #8b949e);
  line-height: 1.2;
}

.architect-domino-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.architect-domino-steps .btn.active,
.architect-build-actions .btn.active {
  border-color: rgba(88, 166, 255, 0.7);
  background: rgba(88, 166, 255, 0.2);
}

.architect-domino-hint {
  margin: 0;
  line-height: 1.35;
}

.architect-build-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.architect-phase-doc {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(88, 166, 255, 0.07), transparent 48%),
    rgba(0, 0, 0, 0.16);
}

.architect-phase-doc-head h3 {
  margin: 8px 0 4px;
  font-size: 1rem;
}

.architect-phase-doc-head .muted {
  margin: 0;
}

.architect-dev-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #f0c674;
  background: rgba(240, 198, 116, 0.14);
  border: 1px solid rgba(240, 198, 116, 0.35);
}

.architect-phase-doc-body {
  display: grid;
  gap: 10px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text, #e6edf3);
}

.architect-phase-doc-body p,
.architect-phase-doc-body ul {
  margin: 0;
}

.architect-phase-doc-body h4 {
  margin: 4px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #9ecbff;
}

.architect-phase-doc-body ul {
  padding-left: 1.1rem;
  display: grid;
  gap: 4px;
  color: var(--muted, #8b949e);
}

.architect-phase-doc-body li strong {
  color: var(--text, #e6edf3);
}

.architect-phase-doc-note {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(240, 198, 116, 0.35);
  background: rgba(240, 198, 116, 0.08);
  color: var(--muted, #8b949e);
}

.architect-legacy-details {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.architect-legacy-details > summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted, #8b949e);
  margin-bottom: 8px;
}

.architect-kit-card,
.architect-connector-card,
.architect-snap-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(88, 166, 255, 0.06);
}

.architect-connector-card {
  background:
    radial-gradient(circle at 8% 0%, rgba(249, 115, 22, 0.14), transparent 38%),
    rgba(88, 166, 255, 0.06);
}

.architect-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.76rem;
}

.architect-grid-row input {
  width: 100%;
  margin-top: 4px;
}

.architect-connector-card label {
  display: grid;
  gap: 4px;
  font-size: 0.76rem;
}

.architect-connector-card input,
.architect-connector-card select {
  width: 100%;
}

.architect-preset-list {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.architect-nudge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.architect-library-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 24px;
}

.architect-library-modal.hidden {
  display: none;
}

.architect-library-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.72);
}

.architect-library-card {
  position: relative;
  width: min(920px, 96vw);
  max-height: min(80vh, 820px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 16px;
}

.architect-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.architect-library-toolbar {
  margin-bottom: 12px;
}

.architect-library-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.architect-library-filter-tab {
  border: 1px solid rgba(139, 148, 158, 0.35);
  background: rgba(13, 17, 23, 0.82);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.architect-library-filter-tab.active {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.8);
  background: rgba(88, 166, 255, 0.22);
}

.architect-library-toolbar input {
  width: 100%;
}

.architect-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.architect-library-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.55);
  min-height: 0;
}

.architect-library-item small {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.architect-library-item strong {
  display: block;
  font-size: 0.84rem;
  line-height: 1.25;
}

.architect-library-item p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.architect-library-item--module {
  cursor: grab;
}

.architect-library-item--module:active {
  cursor: grabbing;
}

.architect-library-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 96px;
  border-radius: 8px;
  border: 1px solid rgba(48, 54, 61, 0.85);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(88, 166, 255, 0.12), transparent 58%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.96), rgba(13, 17, 23, 0.9));
}

.architect-library-preview--file {
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(139, 148, 158, 0.85);
}

.architect-library-preview--model canvas {
  width: 100% !important;
  height: 100% !important;
}

.architect-part-preview {
  position: relative;
  width: 88px;
  height: 72px;
}

.architect-part-preview [class^="ap-"],
.architect-part-preview [class*=" ap-"] {
  position: absolute;
  display: none;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.architect-part-preview .ap-grid {
  display: block;
  inset: 6px;
  border: 1px dashed rgba(88, 166, 255, 0.16);
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
}

.architect-part-preview--wall .ap-wall-a,
.architect-part-preview--low-wall .ap-wall-a {
  display: block;
  left: 30%;
  top: 14%;
  width: 40%;
  height: 72%;
  background: linear-gradient(180deg, #f3ede1, #e8e1d2 58%, #d5cdb9);
}

.architect-part-preview--low-wall .ap-wall-a {
  top: 34%;
  height: 52%;
}

.architect-part-preview--wall .ap-connector-a,
.architect-part-preview--wall .ap-connector-b,
.architect-part-preview--low-wall .ap-connector-a,
.architect-part-preview--low-wall .ap-connector-b {
  display: block;
  width: 12%;
  height: 16%;
  top: 44%;
  background: #5c6b73;
}

.architect-part-preview--wall .ap-connector-a,
.architect-part-preview--low-wall .ap-connector-a {
  left: 12%;
}

.architect-part-preview--wall .ap-connector-b,
.architect-part-preview--low-wall .ap-connector-b {
  right: 12%;
}

.architect-part-preview--corner .ap-wall-a,
.architect-part-preview--corner .ap-wall-b {
  display: block;
  background: linear-gradient(180deg, #f3ede1, #e8e1d2);
}

.architect-part-preview--corner .ap-wall-a {
  left: 46%;
  top: 12%;
  width: 14%;
  height: 76%;
}

.architect-part-preview--corner .ap-wall-b {
  left: 12%;
  top: 12%;
  width: 58%;
  height: 14%;
}

.architect-part-preview--corner .ap-connector-a {
  display: block;
  left: 12%;
  top: 12%;
  width: 18%;
  height: 18%;
  background: #f7f0de;
}

.architect-part-preview--pillar .ap-wall-a {
  display: block;
  left: 34%;
  top: 10%;
  width: 32%;
  height: 78%;
  background: linear-gradient(180deg, #f7f0de, #e8e1d2);
}

.architect-part-preview--pillar .ap-tab-a {
  display: block;
  left: 38%;
  top: 2%;
  width: 24%;
  height: 10%;
  background: #94a3b8;
}

.architect-part-preview--pillar .ap-connector-a,
.architect-part-preview--pillar .ap-connector-b {
  display: block;
  width: 10%;
  height: 22%;
  top: 38%;
  background: #5c6b73;
}

.architect-part-preview--pillar .ap-connector-a {
  left: 16%;
}

.architect-part-preview--pillar .ap-connector-b {
  right: 16%;
}

.architect-part-preview--floor .ap-floor {
  display: block;
  left: 10%;
  top: 28%;
  width: 80%;
  height: 44%;
  background: linear-gradient(180deg, #d8a866, #c79552 55%, #a8743d);
}

.architect-part-preview--floor .ap-connector-a,
.architect-part-preview--floor .ap-connector-b {
  display: block;
  height: 10%;
  background: #d8b074;
}

.architect-part-preview--floor .ap-connector-a {
  left: 10%;
  top: 18%;
  width: 80%;
}

.architect-part-preview--floor .ap-connector-b {
  left: 10%;
  bottom: 18%;
  width: 80%;
}

.architect-part-preview--window .ap-window {
  display: block;
  left: 24%;
  top: 24%;
  width: 52%;
  height: 42%;
  background: linear-gradient(180deg, rgba(111, 182, 255, 0.92), rgba(79, 143, 214, 0.88));
  box-shadow: inset 0 0 0 3px #f7f0de;
}

.architect-part-preview--window .ap-tab-a,
.architect-part-preview--window .ap-tab-b {
  display: block;
  left: 18%;
  width: 64%;
  height: 8%;
  background: #f7f0de;
}

.architect-part-preview--window .ap-tab-a {
  top: 16%;
}

.architect-part-preview--window .ap-tab-b {
  bottom: 24%;
}

.architect-part-preview--door .ap-door {
  display: block;
  left: 30%;
  top: 18%;
  width: 40%;
  height: 58%;
  background: linear-gradient(180deg, #8a613f, #7b5436);
  box-shadow: inset 0 0 0 3px #f7f0de;
}

.architect-part-preview--door .ap-tab-a {
  display: block;
  left: 22%;
  bottom: 16%;
  width: 56%;
  height: 8%;
  background: #f7f0de;
}

.architect-part-preview--window-wall .ap-wall-a,
.architect-part-preview--window-wall .ap-wall-b,
.architect-part-preview--door-wall .ap-wall-a,
.architect-part-preview--door-wall .ap-wall-b {
  display: block;
  top: 12%;
  width: 18%;
  height: 76%;
  background: #e8e1d2;
}

.architect-part-preview--window-wall .ap-wall-a,
.architect-part-preview--door-wall .ap-wall-a {
  left: 10%;
}

.architect-part-preview--window-wall .ap-wall-b,
.architect-part-preview--door-wall .ap-wall-b {
  right: 10%;
}

.architect-part-preview--window-wall .ap-window {
  display: block;
  left: 32%;
  top: 30%;
  width: 36%;
  height: 34%;
  background: rgba(111, 182, 255, 0.88);
  box-shadow: inset 0 0 0 2px #f7f0de;
}

.architect-part-preview--door-wall .ap-door {
  display: block;
  left: 34%;
  top: 24%;
  width: 32%;
  height: 52%;
  background: #7b5436;
  box-shadow: inset 0 0 0 2px #f7f0de;
}

.architect-part-preview--room .ap-floor {
  display: block;
  left: 16%;
  top: 42%;
  width: 68%;
  height: 34%;
  background: #c79552;
}

.architect-part-preview--room .ap-wall-a,
.architect-part-preview--room .ap-wall-b,
.architect-part-preview--room .ap-wall-c {
  display: block;
  background: #e8e1d2;
}

.architect-part-preview--room .ap-wall-a {
  left: 16%;
  top: 10%;
  width: 68%;
  height: 12%;
}

.architect-part-preview--room .ap-wall-b {
  left: 16%;
  top: 22%;
  width: 12%;
  height: 54%;
}

.architect-part-preview--room .ap-wall-c {
  right: 16%;
  top: 22%;
  width: 12%;
  height: 54%;
}

.architect-part-preview--room .ap-window {
  display: block;
  left: 58%;
  top: 28%;
  width: 18%;
  height: 18%;
  background: rgba(111, 182, 255, 0.88);
}

.architect-part-preview--room .ap-door {
  display: block;
  left: 34%;
  top: 28%;
  width: 14%;
  height: 24%;
  background: #7b5436;
}

.architect-part-preview--roof .ap-roof-a,
.architect-part-preview--roof-corner .ap-roof-a {
  display: block;
  left: 10%;
  top: 34%;
  width: 80%;
  height: 24%;
  background: linear-gradient(180deg, #52525b, #3f3f46);
}

.architect-part-preview--roof .ap-tab-a,
.architect-part-preview--roof .ap-tab-b {
  display: block;
  width: 10%;
  height: 18%;
  top: 28%;
  background: #71717a;
}

.architect-part-preview--roof .ap-tab-a {
  left: 8%;
}

.architect-part-preview--roof .ap-tab-b {
  right: 8%;
}

.architect-part-preview--roof-gable .ap-roof-a,
.architect-part-preview--roof-gable .ap-roof-b {
  display: block;
  top: 34%;
  width: 42%;
  height: 24%;
  background: #3f3f46;
}

.architect-part-preview--roof-gable .ap-roof-a {
  left: 8%;
  transform: skewY(-16deg);
}

.architect-part-preview--roof-gable .ap-roof-b {
  right: 8%;
  transform: skewY(16deg);
}

.architect-part-preview--roof-gable .ap-tab-a {
  display: block;
  left: 44%;
  top: 24%;
  width: 12%;
  height: 16%;
  background: #71717a;
}

.architect-part-preview--roof-corner .ap-roof-b {
  display: block;
  right: 10%;
  top: 18%;
  width: 34%;
  height: 18%;
  background: #52525b;
  transform: rotate(90deg);
  transform-origin: top right;
}

.architect-part-preview--service .ap-wall-a {
  display: block;
  left: 24%;
  top: 12%;
  width: 52%;
  height: 76%;
  background: #e8e1d2;
}

.architect-part-preview--service .ap-tab-a {
  display: block;
  left: 30%;
  top: 24%;
  width: 40%;
  height: 34%;
  background: #5c6b73;
}

.architect-part-preview--service .ap-tab-b {
  display: block;
  left: 34%;
  bottom: 14%;
  width: 32%;
  height: 10%;
  background: #94a3b8;
}

.workspace-fusion-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
  font-size: 0.78rem;
}

.workspace-realtime-editor {
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.48);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.workspace-realtime-open {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.workspace-realtime-open-hint {
  padding: 3px 7px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 999px;
  color: #79c0ff;
  background: rgba(88, 166, 255, 0.1);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workspace-realtime-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.workspace-realtime-modal {
  z-index: 19000;
}

.workspace-realtime-modal-card {
  width: min(880px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(88, 166, 255, 0.22);
  background:
    radial-gradient(circle at 8% 0%, rgba(88, 166, 255, 0.16), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(249, 115, 22, 0.12), transparent 30%),
    rgba(13, 17, 23, 0.98);
}

.workspace-realtime-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.18);
}

.workspace-realtime-modal-head h2 {
  margin: 2px 0 4px;
}

.workspace-realtime-modal-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.32fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid rgba(139, 148, 158, 0.14);
}

.workspace-realtime-search,
.workspace-realtime-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.workspace-realtime-search span,
.workspace-realtime-filter span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.workspace-realtime-search input,
.workspace-realtime-filter select {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.88);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.workspace-realtime-view-options {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(139, 148, 158, 0.2);
  border-radius: 999px;
  background: rgba(22, 27, 34, 0.72);
}

.workspace-realtime-view-options button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 6px 9px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.workspace-realtime-view-options button.active {
  background: rgba(88, 166, 255, 0.18);
  color: #79c0ff;
}

.workspace-realtime-connection {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  color: #79c0ff;
  font-size: 0.76rem;
  font-weight: 700;
}

.workspace-realtime-connection small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}

.workspace-realtime-connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.14);
}

.workspace-realtime-connection .is-loading + small,
.workspace-realtime-connection [data-realtime-status].is-loading {
  color: #fb923c;
}

.is-connecting-fusion .workspace-realtime-connection-dot {
  background: #fb923c;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
  animation: realtime-connection-pulse 1s ease-in-out infinite;
}

[data-realtime-status].is-error {
  color: #f85149;
}

.workspace-realtime-modal-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.5fr);
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-top: 14px;
}

.workspace-realtime-filter-hidden {
  display: none !important;
}

@keyframes realtime-connection-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.28); opacity: 0.72; }
}

.workspace-realtime-modal-body .workspace-render-folder-card,
.workspace-realtime-modal-body .workspace-fusion-project-card,
.workspace-realtime-modal-body .workspace-fusion-mirror-card {
  border-color: rgba(139, 148, 158, 0.22);
  background: rgba(22, 27, 34, 0.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.workspace-realtime-modal-body .workspace-render-folder-card {
  align-self: start;
  padding: 12px;
  border-radius: 14px;
}

.workspace-realtime-modal-body .workspace-fusion-projects {
  margin-top: 0;
}

.workspace-realtime-modal-body .workspace-fusion-project-list,
.workspace-realtime-modal-body .workspace-fusion-mirror-list {
  gap: 10px;
}

.workspace-realtime-view-grid .workspace-fusion-project-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.workspace-realtime-view-grid .workspace-fusion-mirror-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.workspace-realtime-view-grid .workspace-realtime-modal-body {
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1.55fr);
}

.workspace-realtime-view-preview .workspace-fusion-browser-list,
.workspace-realtime-view-grid .workspace-fusion-browser-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.workspace-realtime-view-list .workspace-fusion-preview {
  display: none;
}

.workspace-realtime-view-preview .workspace-fusion-browser-row,
.workspace-realtime-view-grid .workspace-fusion-browser-row {
  display: grid;
  min-height: 104px;
  grid-template-columns: auto 1fr;
  align-content: start;
  align-items: start;
}

.workspace-realtime-view-preview .workspace-fusion-browser-icon,
.workspace-realtime-view-grid .workspace-fusion-browser-icon {
  display: none;
}

.workspace-realtime-view-preview .workspace-fusion-file-entry,
.workspace-realtime-view-grid .workspace-fusion-file-entry {
  display: grid;
  grid-template-columns: 1fr;
}

.workspace-realtime-view-preview .workspace-fusion-browser-section--bodies .workspace-fusion-browser-list,
.workspace-realtime-view-grid .workspace-fusion-browser-section--bodies .workspace-fusion-browser-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workspace-realtime-view-preview .workspace-fusion-browser-section--bodies .workspace-fusion-browser-row,
.workspace-realtime-view-grid .workspace-fusion-browser-section--bodies .workspace-fusion-browser-row {
  min-height: 34px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  padding-left: 10px;
}

.workspace-realtime-view-preview .workspace-fusion-browser-section--bodies .workspace-fusion-preview,
.workspace-realtime-view-grid .workspace-fusion-browser-section--bodies .workspace-fusion-preview {
  display: none;
}

.workspace-realtime-view-preview .workspace-fusion-browser-section--bodies .workspace-fusion-browser-icon,
.workspace-realtime-view-grid .workspace-fusion-browser-section--bodies .workspace-fusion-browser-icon {
  display: inline;
}

.workspace-fusion-preview {
  grid-row: span 2;
  width: 52px;
  height: 52px;
  display: none;
  place-items: center;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(88, 166, 255, 0.2), rgba(249, 115, 22, 0.14)),
    rgba(13, 17, 23, 0.72);
  border: 1px solid rgba(88, 166, 255, 0.18);
  color: #79c0ff;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.workspace-realtime-view-preview .workspace-fusion-preview,
.workspace-realtime-view-grid .workspace-fusion-preview {
  display: grid;
}

.workspace-fusion-preview--folder {
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.24);
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(88, 166, 255, 0.1)),
    rgba(13, 17, 23, 0.72);
}

.workspace-fusion-preview--file {
  color: #a5f3fc;
}

.workspace-realtime-model-select {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
}

.workspace-realtime-model-select span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.workspace-realtime-model-select select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.88);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

@media (max-width: 760px) {
  .workspace-realtime-modal-toolbar {
    grid-template-columns: 1fr;
  }

  .workspace-realtime-view-options {
    width: 100%;
    justify-content: space-between;
  }

  .workspace-realtime-view-options button {
    flex: 1;
  }

  .workspace-realtime-modal-body {
    grid-template-columns: 1fr;
  }
}

.workspace-realtime-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.workspace-realtime-toggle {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(139, 148, 158, 0.32);
  border-radius: 7px;
  background: rgba(22, 27, 34, 0.82);
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.workspace-realtime-toggle:hover {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.5);
}

.workspace-realtime-body {
  display: block;
  min-width: 0;
}

.workspace-realtime-editor.is-collapsed .workspace-realtime-body {
  display: none;
}

.workspace-realtime-editor.is-collapsed .workspace-realtime-toggle {
  transform: none;
}

.workspace-realtime-active {
  margin-top: 8px;
}

.workspace-realtime-active-chip {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 8px;
  background: rgba(88, 166, 255, 0.08);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.workspace-realtime-active-chip strong {
  font-size: 0.82rem;
  color: var(--text);
}

.workspace-realtime-active-chip small {
  color: var(--muted);
  font-size: 0.68rem;
}

.workspace-realtime-focus {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.55);
  min-width: 0;
}

.workspace-realtime-focus.hidden {
  display: none !important;
}

.workspace-realtime-focus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.workspace-realtime-focus-head h2 {
  margin: 0;
  font-size: 0.92rem;
}

.workspace-realtime-focus-head .muted {
  margin: 2px 0 0;
}

.workspace-browser-section.is-realtime-suppressed {
  display: none !important;
}

.workspace-realtime-mirror-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.workspace-realtime-mirror-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.workspace-realtime-mirror-summary strong {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.workspace-realtime-mirror-cards {
  display: grid;
  gap: 6px;
}

.workspace-realtime-mirror-card {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(48, 54, 61, 0.7);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.65);
}

.workspace-realtime-mirror-card.is-stale {
  border-color: rgba(248, 81, 73, 0.35);
}

.workspace-realtime-mirror-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.workspace-realtime-mirror-card-head > span {
  font-weight: 700;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-realtime-mirror-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.72rem;
  color: #79c0ff;
}

.workspace-realtime-mirror-empty {
  padding: 8px;
  border: 1px dashed rgba(48, 54, 61, 0.8);
  border-radius: 8px;
}

.workspace-realtime-browser-host {
  min-width: 0;
}

.design-browser-root--realtime-focus {
  max-height: min(52vh, 560px);
  min-height: 180px;
}

.workspace-realtime-editor.is-collapsed .workspace-realtime-body {
  display: none;
}

.workspace-realtime-editor.is-collapsed .workspace-realtime-toggle {
  transform: rotate(-90deg);
}

.workspace-render-folder-card {
  display: grid;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid rgba(48, 54, 61, 0.65);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.45);
}

.workspace-render-folder-card strong,
.workspace-fusion-projects strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}

.workspace-fusion-link-btn {
  margin-top: 8px;
  justify-self: start;
}

.workspace-fusion-projects {
  margin-top: 8px;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.workspace-fusion-project-list,
.workspace-fusion-mirror-list {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.workspace-fusion-project-card,
.workspace-fusion-mirror-card {
  border: 1px solid rgba(48, 54, 61, 0.65);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.58);
  padding: 6px;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.workspace-fusion-project-card--current {
  border-color: rgba(0, 120, 212, 0.45);
  box-shadow: inset 0 0 0 1px rgba(0, 120, 212, 0.12);
}

.workspace-fusion-project-card--stale,
.workspace-fusion-mirror-card--stale {
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.05);
}

.workspace-fusion-stale-banner {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  padding: 8px;
  border: 1px solid rgba(248, 81, 73, 0.28);
  border-radius: 8px;
  background: rgba(248, 81, 73, 0.06);
}

.workspace-fusion-stale-badge {
  color: #f85149;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.62rem;
}

.fusion-mirrors-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.workspace-fusion-project-head,
.workspace-fusion-mirror-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.workspace-fusion-project-head > span,
.workspace-fusion-mirror-head > span {
  color: var(--text);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-fusion-mirror-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 4px 0 2px;
}

.workspace-fusion-version-link {
  color: #79c0ff;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.workspace-fusion-version-link:hover {
  text-decoration: underline;
}

.workspace-fusion-mirror-hint {
  margin: 0 0 6px;
  font-size: 0.68rem;
  line-height: 1.35;
}

.workspace-fusion-mirror-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.workspace-fusion-file-entry,
.fusion-workspace-browse-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
}

.workspace-fusion-file-entry .workspace-fusion-browser-row,
.fusion-workspace-browse-entry .fusion-workspace-browse-row {
  min-width: 0;
}

.workspace-fusion-file-save-btn,
.fusion-workspace-browse-entry .btn-compact {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 0.65rem;
  margin-right: 4px;
}

.workspace-fusion-browser {
  border: 1px solid rgba(48, 54, 61, 0.65);
  border-radius: 8px;
  margin: 5px 0;
  overflow: hidden;
  max-width: 100%;
}

.workspace-fusion-browser-section {
  border-bottom: 1px solid rgba(48, 54, 61, 0.45);
}

.workspace-fusion-browser-section:last-child {
  border-bottom: none;
}

.workspace-fusion-browser-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  cursor: pointer;
  list-style: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
}

.workspace-fusion-browser-summary::-webkit-details-marker {
  display: none;
}

.workspace-fusion-browser-summary small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}

.workspace-fusion-browser-list {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

.workspace-fusion-browser-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) minmax(42px, 8ch);
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 7px;
  border: 0;
  border-top: 1px solid rgba(48, 54, 61, 0.35);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.68rem;
  min-width: 0;
}

.workspace-fusion-browser-row-child {
  padding-left: 14px;
}

.workspace-fusion-browser-row-static {
  cursor: default;
}

.workspace-fusion-browser-row:not(:disabled):not(.workspace-fusion-browser-row-static) {
  cursor: pointer;
}

.workspace-fusion-browser-row:not(:disabled):not(.workspace-fusion-browser-row-static):hover {
  background: rgba(88, 166, 255, 0.08);
}

.workspace-fusion-browser-row[draggable="true"] {
  cursor: grab;
}

.workspace-fusion-browser-row[draggable="true"]:active {
  cursor: grabbing;
}

.workspace-fusion-browser-row:disabled {
  opacity: 0.55;
  cursor: default;
}

.workspace-fusion-browser-icon {
  color: var(--muted);
  text-align: center;
}

.workspace-fusion-browser-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-fusion-browser-row small {
  color: var(--muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 8ch;
}

.workspace-fusion-browser-empty {
  padding: 6px 8px;
  margin: 0;
}

.workspace-fusion-file-row small {
  max-width: 10ch;
}

.workspace-fusion-file-entry--live .workspace-fusion-browser-row {
  outline: 1px solid color-mix(in srgb, var(--accent, #3d8bfd) 55%, transparent);
  background: color-mix(in srgb, var(--accent, #3d8bfd) 10%, transparent);
}

.fusion-workspace-file-modal .fusion-workspace-file-card {
  width: min(520px, calc(100vw - 24px));
  max-height: min(84vh, 720px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fusion-workspace-file-section {
  display: grid;
  gap: 8px;
}

.fusion-workspace-file-section h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text);
}

.fusion-workspace-dest {
  display: grid;
  gap: 6px;
}

.fusion-workspace-dest-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(13, 17, 23, 0.45);
}

.fusion-workspace-dest-option:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.fusion-workspace-dest-option:has(input:checked) {
  border-color: rgba(0, 120, 212, 0.55);
  background: rgba(0, 120, 212, 0.1);
}

.fusion-workspace-dest-option input {
  margin-top: 3px;
}

.fusion-workspace-dest-option span {
  display: grid;
  gap: 2px;
}

.fusion-workspace-dest-option strong {
  font-size: 0.8rem;
}

.fusion-workspace-dest-option small {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.fusion-workspace-folder-field select {
  width: 100%;
  margin-top: 6px;
}

.fusion-workspace-file-actions {
  flex-wrap: wrap;
}

.fusion-workspace-file-status {
  margin: 0;
  min-height: 1.2em;
}

.fusion-workspace-file-status.error {
  color: var(--danger, #f85149);
}

.fusion-workspace-folder-list {
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  background: rgba(13, 17, 23, 0.35);
}

.fusion-workspace-browse-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.fusion-workspace-browse-row:hover {
  background: rgba(0, 120, 212, 0.1);
  border-color: rgba(0, 120, 212, 0.35);
}

.fusion-workspace-browse-row span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fusion-workspace-browse-row small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.browser-chevron {
  color: var(--muted);
  font-size: 0.65rem;
}

/* ── Agent App Store ── */
.agent-store-page .skills-list {
  margin-bottom: 32px;
}

.agent-store-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 18px;
  align-items: center;
  padding: 20px;
  border: 1px solid rgba(56, 139, 253, 0.3);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 20%, rgba(56, 139, 253, 0.22), transparent 35%),
    linear-gradient(135deg, rgba(13, 17, 23, 0.98), rgba(22, 27, 34, 0.98));
  margin-bottom: 16px;
}

.marketplace-modern-hero {
  position: relative;
  overflow: hidden;
  border-color: rgba(251, 133, 0, 0.34);
  background:
    radial-gradient(circle at 12% 16%, rgba(251, 133, 0, 0.22), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(56, 139, 253, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(13, 17, 23, 0.98), rgba(22, 27, 34, 0.98));
  box-shadow: 0 18px 60px rgba(1, 4, 9, 0.28);
}

.marketplace-modern-hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: rgba(251, 133, 0, 0.1);
  pointer-events: none;
}

.model-store-page {
  max-width: min(1220px, 100%);
}

.model-store-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.74fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: clamp(22px, 3vw, 32px);
  overflow: hidden;
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 18%, rgba(249, 115, 22, 0.22), transparent 34%),
    radial-gradient(circle at 82% 14%, rgba(88, 166, 255, 0.22), transparent 32%),
    linear-gradient(145deg, rgba(8, 13, 23, 0.98), rgba(13, 17, 23, 0.95));
  box-shadow: 0 28px 90px rgba(1, 4, 9, 0.34);
}

.model-store-hero-copy {
  position: relative;
  z-index: 1;
  align-self: center;
}

.model-store-hero .info-lead {
  max-width: 68ch;
}

.model-store-hero-panel {
  position: relative;
  display: grid;
  align-content: stretch;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(rgba(88, 166, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 50% 20%, rgba(88, 166, 255, 0.18), transparent 36%),
    rgba(1, 4, 9, 0.58);
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.model-store-hero-visual {
  position: relative;
  min-height: 238px;
}

.model-store-arm-base,
.model-store-arm-joint,
.model-store-arm-link,
.model-store-arm-tool,
.model-store-build-grid {
  position: absolute;
  display: block;
}

.model-store-arm-base {
  left: 54px;
  bottom: 36px;
  width: 118px;
  height: 34px;
  border: 1px solid rgba(255, 237, 213, 0.42);
  border-radius: 999px;
  background: linear-gradient(180deg, #f97316, #7c2d12);
  box-shadow: 0 0 24px rgba(249, 115, 22, 0.28);
}

.model-store-arm-joint {
  border-radius: 50%;
  border: 9px solid #f97316;
  background: radial-gradient(circle, #0f172a 0 36%, #e2e8f0 37% 48%, #475569 49% 100%);
  box-shadow: 0 0 0 3px rgba(255, 237, 213, 0.42), 0 0 26px rgba(249, 115, 22, 0.28);
}

.model-store-arm-joint--base {
  left: 82px;
  bottom: 66px;
  width: 78px;
  height: 78px;
}

.model-store-arm-joint--mid {
  left: 180px;
  bottom: 154px;
  width: 58px;
  height: 58px;
}

.model-store-arm-joint--end {
  left: 280px;
  bottom: 126px;
  width: 44px;
  height: 44px;
}

.model-store-arm-link {
  height: 30px;
  border: 1px solid rgba(255, 237, 213, 0.42);
  border-radius: 999px;
  background: linear-gradient(90deg, #b45309, #f97316 62%, #fdba74);
  box-shadow: inset 0 -8px 9px rgba(124, 45, 18, 0.52), 0 0 18px rgba(249, 115, 22, 0.24);
  transform-origin: left center;
}

.model-store-arm-link--one {
  left: 132px;
  bottom: 132px;
  width: 108px;
  transform: rotate(-36deg);
}

.model-store-arm-link--two {
  left: 220px;
  bottom: 150px;
  width: 94px;
  height: 20px;
  transform: rotate(18deg);
}

.model-store-arm-tool {
  left: 318px;
  bottom: 128px;
  width: 76px;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  transform: rotate(-26deg);
  filter: drop-shadow(0 0 8px rgba(125, 211, 252, 0.45));
}

.model-store-arm-tool::before,
.model-store-arm-tool::after {
  content: "";
  position: absolute;
  right: -28px;
  width: 42px;
  height: 7px;
  border-radius: 999px;
  background: #cbd5e1;
  transform-origin: left center;
}

.model-store-arm-tool::before { transform: rotate(-32deg); }
.model-store-arm-tool::after { transform: rotate(32deg); }

.model-store-build-grid {
  right: 36px;
  bottom: 36px;
  width: 110px;
  height: 78px;
  border: 1px solid rgba(88, 166, 255, 0.38);
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(226, 232, 240, 0.17) 0 3px, rgba(249, 115, 22, 0.14) 3px 8px),
    linear-gradient(145deg, rgba(148, 163, 184, 0.25), rgba(249, 115, 22, 0.15));
  clip-path: polygon(0 100%, 0 58%, 16% 58%, 16% 36%, 34% 36%, 34% 18%, 52% 18%, 52% 0, 74% 0, 74% 26%, 90% 26%, 90% 100%);
  box-shadow: 0 0 24px rgba(88, 166, 255, 0.18);
}

.model-store-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(139, 148, 158, 0.16);
  background: rgba(13, 17, 23, 0.68);
}

.model-store-hero-stats span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.model-store-hero-stats strong {
  color: #f0f6fc;
  font-size: 0.92rem;
}

.model-store-hero-stats small {
  color: var(--muted);
  font-size: 0.72rem;
}

.marketplace-store-page .marketplace-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 12px 0 10px;
  padding: 14px;
  border: 1px solid rgba(88, 166, 255, 0.16);
  border-radius: 18px;
  background: rgba(13, 17, 23, 0.62);
}

.marketplace-store-page .marketplace-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.marketplace-store-page .marketplace-filters select {
  min-height: 40px;
  border: 1px solid rgba(139, 148, 158, 0.26);
  border-radius: 12px;
  background: #0d1117;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.marketplace-store-page .marketplace-filter-check {
  min-height: 40px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(139, 148, 158, 0.26);
  border-radius: 12px;
  background: #0d1117;
}

.agent-store-hero h3 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
}

.agent-store-search input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #0d1117;
  color: var(--text);
  font: inherit;
}

.agent-store-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin: 14px 0 24px;
}

.agent-category-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0d1117;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.agent-category-tile:hover,
.agent-category-tile.active {
  border-color: rgba(56, 139, 253, 0.7);
  background: #161b22;
  box-shadow: 0 0 0 1px rgba(31, 111, 235, 0.18) inset;
  transform: translateY(-1px);
}

.agent-category-tile span {
  font-weight: 800;
}

.agent-category-tile small {
  color: var(--muted);
}

.agent-store-section {
  margin: 0 0 30px;
}

.agent-store-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.agent-store-section-head h3 {
  margin: 0;
}

.agent-featured-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 280px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.agent-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.agent-product-card {
  display: flex;
  flex-direction: column;
  min-height: 330px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 36%),
    #0d1117;
  box-shadow: 0 14px 34px rgba(1, 4, 9, 0.18);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.agent-product-card:hover {
  border-color: rgba(56, 139, 253, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 18px 46px rgba(1, 4, 9, 0.26);
}

.agent-product-card-compact {
  min-height: 260px;
}

.agent-product-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.agent-product-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1f6feb, #8957e5);
  color: white;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.agent-product-card h4 {
  margin: 0 0 4px;
  font-size: 1.06rem;
}

.agent-product-slug {
  margin: 0 0 10px;
}

.agent-creator-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  padding: 4px 8px 4px 4px;
  border: 1px solid rgba(48, 54, 61, 0.74);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
}

.agent-creator-link:hover {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.56);
  background: rgba(56, 139, 253, 0.12);
}

.agent-creator-link:disabled {
  cursor: default;
  opacity: 0.8;
}

.agent-creator-avatar,
.agent-profile-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.32), rgba(137, 87, 229, 0.32));
  color: var(--text);
  font-weight: 800;
  overflow: hidden;
}

.agent-creator-avatar {
  width: 22px;
  height: 22px;
  font-size: 0.68rem;
}

.agent-profile-avatar {
  width: 58px;
  height: 58px;
  font-size: 1rem;
}

.agent-creator-avatar--image,
.agent-profile-avatar--image {
  background-size: cover !important;
  background-position: center !important;
  color: transparent;
}

.agent-creator-profile {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(56, 139, 253, 0.12), rgba(137, 87, 229, 0.1));
}

.agent-creator-profile h4,
.agent-creator-profile p {
  margin: 0;
}

.agent-creator-profile .btn {
  margin-left: auto;
}

.agent-product-tagline {
  margin: 0 0 10px;
  color: var(--text);
  font-weight: 650;
  line-height: 1.35;
}

.agent-product-desc {
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Complete docs + public Agent Store docs ─────────────────────────────── */

body.docs-body .docs-content {
  max-width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 28px);
  box-sizing: border-box;
  transition: max-width 0.22s ease, margin 0.22s ease;
}

body.docs-body.gs-agent-open .docs-content {
  margin-left: 0;
  margin-right: 0;
}

@media (min-width: 981px) {
  body.docs-body.gs-agent-open .docs-content {
    /* Fill up to a tight gap before the floating agent (≈420px + 16px). */
    max-width: none;
    width: calc(100% - 436px);
  }
}

.docs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 18px;
}

.info-page .gs-hero-actions .btn,
.info-page .docs-hero-actions .btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  color: #e6edf3;
  text-decoration: none;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.info-page .gs-hero-actions .btn:hover,
.info-page .docs-hero-actions .btn:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 166, 255, 0.58);
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.16), rgba(88, 166, 255, 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 30px rgba(0, 0, 0, 0.24);
}

.info-page .gs-hero-actions .btn.accent,
.info-page .docs-hero-actions .btn.accent {
  border-color: rgba(46, 160, 67, 0.58);
  background: linear-gradient(135deg, rgba(35, 134, 54, 0.88), rgba(46, 160, 67, 0.3));
  color: #f0fff4;
}

.docs-topic-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px 16px;
  align-items: end;
  margin: 18px 0 20px;
  padding: 13px;
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(88, 166, 255, 0.12), transparent 36%),
    rgba(13, 17, 23, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.docs-topic-search::after,
.docs-catalog-filter::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 214, 10, 0) 36%, rgba(255, 214, 10, 0.58) 48%, rgba(255, 214, 10, 0.16) 57%, transparent 70%);
  transform: translateX(-115%);
  opacity: 0;
}

.docs-topic-search.is-searching::after,
.docs-catalog-filter.is-searching::after {
  animation: docs-search-streak 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes docs-search-streak {
  0% {
    transform: translateX(-115%);
    opacity: 0;
  }
  18% {
    opacity: 0.72;
  }
  100% {
    transform: translateX(115%);
    opacity: 0;
  }
}

.docs-topic-search-kicker {
  margin: 0 0 6px;
  color: #79b8ff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-topic-search label {
  position: relative;
  z-index: 1;
  display: block;
  margin: 0;
}

.docs-topic-search input,
.docs-catalog-filter input {
  width: 100%;
  max-width: none;
  padding: 11px 13px 11px 38px;
  border: 1px solid rgba(139, 148, 158, 0.26);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(88, 166, 255, 0.16), transparent 34px),
    #0d1117;
  color: #f0f6fc;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.docs-topic-search input:focus,
.docs-catalog-filter input:focus {
  outline: none;
  border-color: rgba(88, 166, 255, 0.64);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.14);
}

.docs-topic-search-status {
  position: relative;
  z-index: 1;
  max-width: 280px;
  margin: 0;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .docs-topic-search {
    grid-template-columns: 1fr;
  }

  .docs-topic-search-status {
    max-width: none;
  }
}

.docs-complete-section {
  margin: 48px 0 40px;
  padding: 28px 0 8px;
  border-top: 1px solid rgba(48, 54, 61, 0.85);
}

.docs-complete-header {
  margin-bottom: 22px;
}

.docs-complete-header h3 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  border: 0;
  padding: 0;
}

.docs-complete-lead {
  margin: 0;
  max-width: 62ch;
  line-height: 1.55;
}

.docs-reference-band {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgba(48, 54, 61, 0.85);
}

.docs-reference-header {
  margin-bottom: 22px;
}

.docs-reference-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  border: 0;
  padding: 0;
}

.docs-catalog-layout {
  display: grid;
  grid-template-columns: minmax(180px, 210px) minmax(0, 1fr);
  gap: 28px 32px;
  align-items: start;
}

.docs-catalog-nav {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  border: 1px solid rgba(48, 54, 61, 0.9);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.88);
}

.docs-catalog-nav-title {
  margin: 0 0 10px;
  padding: 0 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-catalog-nav a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: #c9d1d9;
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.3;
}

.docs-catalog-nav a:hover {
  background: rgba(88, 166, 255, 0.12);
  color: #e6edf3;
}

.docs-catalog-nav a em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.docs-catalog-gs-link {
  margin-top: 10px;
  border-top: 1px solid rgba(48, 54, 61, 0.85);
  padding-top: 10px !important;
  color: #58a6ff !important;
  font-weight: 650;
}

.docs-catalog-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 8px;
}

.docs-catalog-intro h3 {
  margin: 4px 0 8px;
}

.docs-catalog-filter {
  display: block;
  flex: 1 1 280px;
  margin: 0;
}

.docs-catalog-count {
  margin: 0;
  white-space: nowrap;
}

.docs-category {
  margin: 26px 0 4px;
  padding-top: 6px;
}

.docs-category.is-hidden,
.docs-feature-card.is-hidden,
.gs-feature.is-hidden,
.gs-tip-card.is-hidden,
.gs-tips-section.is-hidden,
.agent-doc-card.is-hidden,
.agent-doc-category.is-hidden,
.agent-store-section.is-hidden {
  display: none !important;
}

.docs-category-head {
  margin-bottom: 12px;
}

.docs-category-head h3 {
  margin: 0 0 4px;
  font-size: 1.12rem;
  font-weight: 700;
  border: 0;
  padding: 0;
}

.docs-category-head .muted {
  margin: 0;
  font-size: 0.88rem;
}

.docs-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.docs-feature-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 12px;
  background: rgba(22, 27, 34, 0.92);
}

.docs-feature-gif-wrap {
  aspect-ratio: 16 / 10;
  background: #0d1117;
  overflow: hidden;
  border-bottom: 1px solid rgba(48, 54, 61, 0.7);
}

.docs-feature-gif-wrap--empty {
  background:
    linear-gradient(145deg, #161b22, #0d1117),
    repeating-linear-gradient(90deg, transparent, transparent 22px, rgba(88, 166, 255, 0.04) 22px, rgba(88, 166, 255, 0.04) 23px);
  min-height: 0;
  aspect-ratio: 16 / 7;
}

.docs-feature-gif {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.docs-feature-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 16px;
  flex: 1;
}

.docs-feature-body h4,
.agent-doc-card h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.docs-feature-summary {
  margin: 0;
  color: #9da7b3;
  font-size: 0.86rem;
  line-height: 1.45;
}

.docs-feature-where {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #c9d1d9;
}

.docs-feature-where span {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0883e;
}

.docs-feature-steps {
  margin: 6px 0 0;
  padding-left: 1.15rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #c9d1d9;
}

.docs-feature-steps li + li {
  margin-top: 3px;
}

.docs-feature-more {
  margin: 2px 0 0;
}

.docs-feature-ask {
  margin: auto 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(48, 54, 61, 0.65);
  font-size: 0.78rem;
}

@media (max-width: 980px) {
  body.docs-body.gs-agent-open .docs-content {
    max-width: 100%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  body.gs-agent-open .gs-page {
    max-width: 100%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .docs-catalog-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .docs-catalog-nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 4px 8px;
  }

  .docs-catalog-nav-title,
  .docs-catalog-gs-link {
    grid-column: 1 / -1;
  }

  .docs-feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1200px) {
  .docs-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.agent-docs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.agent-docs-head h3 {
  margin-top: 0;
}

.agent-docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.agent-docs-toolbar .docs-catalog-filter {
  flex: 1 1 420px;
  margin: 0;
}

.agent-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.agent-doc-grid--recent {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.agent-doc-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 0%, rgba(88, 166, 255, 0.11), transparent 40%),
    #0d1117;
}

.agent-doc-card:hover {
  border-color: rgba(88, 166, 255, 0.45);
}

.agent-doc-category {
  margin: 18px 0 22px;
}

.agent-doc-meta {
  margin: 0 0 7px;
  line-height: 1.35;
}

.agent-doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.agent-doc-empty {
  padding: 18px;
  border: 1px dashed rgba(139, 148, 158, 0.38);
  border-radius: 14px;
  background: rgba(13, 17, 23, 0.58);
}

.agent-doc-empty h4 {
  margin: 0 0 6px;
}

.agent-app-price {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: rgba(56, 139, 253, 0.12);
  font-weight: 700;
  white-space: nowrap;
}

.agent-app-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.agent-app-badge {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
}

.agent-app-actions,
.agent-admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.agent-app-actions {
  margin-top: auto;
  padding-top: 12px;
}

.agent-submit-section {
  padding-top: 8px;
}

.agent-app-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

.agent-app-form input,
.agent-app-form select,
.agent-app-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.marketplace-hub-hero {
  text-align: left;
}

.marketplace-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.marketplace-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 22px;
  background:
    radial-gradient(circle at 22% 12%, rgba(56, 139, 253, 0.16), transparent 34%),
    linear-gradient(145deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98));
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 18px 46px rgba(1, 4, 9, 0.22);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.marketplace-choice::after {
  content: "";
  position: absolute;
  right: -52px;
  bottom: -62px;
  width: 190px;
  height: 190px;
  border-radius: 48px;
  transform: rotate(16deg);
  background: rgba(56, 139, 253, 0.09);
}

.marketplace-choice:hover {
  border-color: rgba(88, 166, 255, 0.62);
  transform: translateY(-3px);
  box-shadow: 0 24px 70px rgba(1, 4, 9, 0.34);
}

.marketplace-choice--knowledge {
  background:
    radial-gradient(circle at 18% 12%, rgba(251, 133, 0, 0.2), transparent 36%),
    linear-gradient(145deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98));
}

.marketplace-choice--knowledge::after {
  background: rgba(251, 133, 0, 0.12);
}

.marketplace-choice strong {
  position: relative;
  z-index: 1;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}

.marketplace-choice p,
.marketplace-choice-kicker,
.marketplace-choice-cta {
  position: relative;
  z-index: 1;
}

.marketplace-choice p {
  color: var(--muted);
  line-height: 1.5;
}

.marketplace-choice-kicker {
  align-self: flex-start;
  padding: 5px 10px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 999px;
  color: #58a6ff;
  background: rgba(56, 139, 253, 0.12);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.marketplace-choice--knowledge .marketplace-choice-kicker {
  border-color: rgba(251, 133, 0, 0.32);
  color: #ffa657;
  background: rgba(251, 133, 0, 0.12);
}

.marketplace-choice-cta {
  margin-top: auto;
  color: var(--text);
  font-weight: 800;
}

.marketplace-drop-zone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 124px;
  margin: 0 0 16px;
  padding: 18px;
  border: 1.5px dashed rgba(139, 148, 158, 0.45);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(88, 166, 255, 0.1), transparent 42%),
    rgba(13, 17, 23, 0.72);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.marketplace-drop-zone span {
  max-width: 70ch;
  color: var(--muted);
  font-size: 0.86rem;
}

.marketplace-drop-zone:hover,
.marketplace-drop-zone.is-dragging {
  border-color: rgba(251, 133, 0, 0.72);
  background:
    radial-gradient(circle at 50% 0%, rgba(251, 133, 0, 0.15), transparent 44%),
    rgba(22, 27, 34, 0.9);
  transform: translateY(-1px);
}

.marketplace-drop-zone.has-files {
  border-style: solid;
  border-color: rgba(63, 185, 80, 0.58);
  background:
    radial-gradient(circle at 50% 0%, rgba(63, 185, 80, 0.13), transparent 44%),
    rgba(13, 17, 23, 0.72);
}

.marketplace-thumb--kb {
  color: #0d1117;
  background:
    linear-gradient(135deg, #ffa657, #f0883e);
  font-weight: 950;
}

.model-product-card {
  position: relative;
  overflow: hidden;
  min-height: 440px;
  padding: 0;
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 0%, rgba(249, 115, 22, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 34%),
    #0d1117;
}

.model-product-card .agent-product-top,
.model-product-card h4,
.model-product-card .agent-product-slug,
.model-product-card .agent-app-badges,
.model-product-card .agent-product-tagline,
.model-product-card .marketplace-body,
.model-product-card .model-file-tags,
.model-product-card .agent-app-actions,
.model-product-card .agent-admin-controls {
  margin-left: 16px;
  margin-right: 16px;
}

.model-marketplace-thumb {
  width: 100%;
  height: 178px;
  margin: 0 0 14px;
  border: 0;
  border-bottom: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 0;
  background-size: cover;
  background-position: center;
}

.model-marketplace-thumb--generated {
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(88, 166, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.14) 1px, transparent 1px),
    radial-gradient(circle at 50% 38%, rgba(249, 115, 22, 0.24), transparent 42%),
    #050914;
  background-size: 32px 32px, 32px 32px, auto, auto;
  color: #fdba74;
  font-size: 2rem;
  font-weight: 950;
}

.model-product-owner {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.model-product-card .agent-app-price {
  border-color: rgba(63, 185, 80, 0.34);
  background: rgba(46, 160, 67, 0.12);
  color: #7ee787;
}

.model-product-card .agent-app-badge {
  border-color: rgba(88, 166, 255, 0.22);
  background: rgba(88, 166, 255, 0.08);
}

.model-product-card .marketplace-body {
  max-height: 112px;
  overflow: hidden;
  line-height: 1.5;
}

.model-file-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.model-file-tags span {
  padding: 4px 8px;
  border: 1px solid rgba(249, 115, 22, 0.26);
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.09);
  color: #ffa657;
  font-size: 0.68rem;
  font-weight: 900;
}

.model-product-card--compact {
  min-height: 320px;
}

.model-product-card--compact .model-marketplace-thumb {
  height: 132px;
}

@media (max-width: 920px) {
  .model-store-hero {
    grid-template-columns: 1fr;
  }

  .model-store-hero-panel {
    min-height: 280px;
  }

  .marketplace-store-page .marketplace-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .marketplace-store-page .marketplace-filters {
    grid-template-columns: 1fr;
  }

  .model-store-hero-stats {
    grid-template-columns: 1fr;
  }

  .model-store-hero-panel {
    min-height: 340px;
  }

  .model-store-hero-visual {
    transform: scale(0.82);
    transform-origin: left bottom;
  }
}

.agent-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.agent-form-wide,
.agent-check {
  grid-column: 1 / -1;
}

.agent-check {
  flex-direction: row !important;
  align-items: center;
}

.agent-check input {
  width: auto;
}

.skill-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 3px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
}

.skill-chip-remove:hover {
  background: rgba(248, 81, 73, 0.22);
  color: #ff7b72;
}

.prompt-skill-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.prompt-skill-add select {
  max-width: 150px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #0d1117;
  color: var(--text);
}

.prompt-skills-chips--planned {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-skills-plan.hidden {
  display: none;
}

/* ── Feedback / bug report modal ─────────────────────────────────────── */
.feedback-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 166, 87, 0.12), transparent 42%),
    radial-gradient(ellipse at 80% 90%, rgba(56, 139, 253, 0.1), transparent 40%),
    rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(10px);
  animation: feedback-fade-in 160ms ease-out;
}

.feedback-modal-backdrop--idea {
  background:
    radial-gradient(ellipse at 18% 12%, rgba(63, 185, 80, 0.12), transparent 42%),
    radial-gradient(ellipse at 82% 88%, rgba(56, 139, 253, 0.1), transparent 40%),
    rgba(1, 4, 9, 0.72);
}

@keyframes feedback-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.feedback-modal {
  width: min(560px, 96vw);
  max-height: min(820px, 94vh);
  overflow: auto;
  padding: 20px 20px 16px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(28, 33, 40, 0.98), rgba(13, 17, 23, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: feedback-rise 180ms ease-out;
}

@keyframes feedback-rise {
  from { transform: translateY(10px); opacity: 0.85; }
  to { transform: translateY(0); opacity: 1; }
}

.feedback-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.feedback-modal-brand {
  min-width: 0;
}

.feedback-kind-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 10px;
  border-radius: 999px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  background: rgba(1, 4, 9, 0.55);
}

.feedback-kind-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
  background: transparent;
  color: #8b949e;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.feedback-kind-btn.active[data-feedback-kind="bug"] {
  color: #0d1117;
  background: #ffa657;
}

.feedback-kind-btn.active[data-feedback-kind="suggestion"] {
  color: #0d1117;
  background: #3fb950;
}

.feedback-modal-head h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.feedback-sub {
  margin: 0;
  color: #8b949e;
  font-size: 0.8rem;
  line-height: 1.4;
  max-width: 42ch;
}

.feedback-modal-close {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.9);
  color: #c9d1d9;
  cursor: pointer;
  font-size: 1.15rem;
}

.feedback-modal-close:hover {
  border-color: #8b949e;
  color: #fff;
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;
}

.feedback-field--message {
  margin-top: 4px;
}

.feedback-field textarea,
.feedback-field select {
  width: 100%;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: #010409;
  color: #e6edf3;
  font: inherit;
  font-weight: 500;
}

.feedback-field textarea {
  resize: vertical;
  min-height: 110px;
  padding: 12px 13px;
  line-height: 1.45;
}

.feedback-field textarea:focus,
.feedback-field select:focus {
  outline: none;
  border-color: rgba(56, 139, 253, 0.7);
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.15);
}

.feedback-field select {
  padding: 9px 10px;
}

.feedback-dropzone {
  margin-top: 14px;
  min-height: 132px;
  padding: 12px;
  border: 1.5px dashed rgba(139, 148, 158, 0.45);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.55), rgba(1, 4, 9, 0.35));
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.feedback-dropzone:hover,
.feedback-dropzone.is-dragover {
  border-color: rgba(56, 139, 253, 0.75);
  background: rgba(31, 111, 235, 0.1);
}

.feedback-dropzone.is-dragover {
  transform: scale(1.01);
}

.feedback-drop-hint {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 108px;
  text-align: center;
  color: #8b949e;
  pointer-events: none;
}

.feedback-drop-hint strong {
  color: #e6edf3;
  font-size: 0.92rem;
}

.feedback-drop-hint span {
  font-size: 0.74rem;
}

.feedback-drop-hint.hidden {
  display: none;
}

.feedback-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.feedback-shots.is-empty {
  display: none;
}

.feedback-shot {
  position: relative;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(48, 54, 61, 0.95);
  background: #010409;
}

.feedback-shot img {
  display: block;
  width: 100%;
  height: 84px;
  object-fit: cover;
}

.feedback-shot figcaption {
  padding: 4px 6px;
  font-size: 0.62rem;
  color: #8b949e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feedback-shot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(1, 4, 9, 0.78);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.feedback-context {
  margin-top: 12px;
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: 12px;
  background: rgba(1, 4, 9, 0.35);
  padding: 0 12px 10px;
}

.feedback-context summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 0;
  color: #c9d1d9;
  font-size: 0.78rem;
  font-weight: 650;
}

.feedback-context summary::-webkit-details-marker {
  display: none;
}

.feedback-context-note {
  margin: 8px 0 0;
}

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.feedback-status {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #8b949e;
}

.feedback-status.is-ok {
  color: #3fb950;
}

.feedback-status.is-error {
  color: #ff7b72;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.feedback-page-drop {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 2350;
  display: block;
  width: min(360px, calc(100vw - 36px));
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

.feedback-page-drop.hidden {
  display: none;
}

.feedback-page-drop-card {
  pointer-events: auto;
  display: grid;
  gap: 6px;
  justify-items: start;
  text-align: left;
  min-width: 0;
  padding: 15px 16px;
  border-radius: 14px;
  border: 1.5px dashed rgba(56, 139, 253, 0.7);
  background:
    radial-gradient(circle at 0% 0%, rgba(56, 139, 253, 0.18), transparent 62%),
    rgba(13, 17, 23, 0.9);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.34);
  animation: feedback-rise 160ms ease-out;
}

.feedback-page-drop-card strong {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.feedback-page-drop-card > span {
  color: #8b949e;
  font-size: 0.82rem;
  max-width: 34ch;
}

.feedback-page-drop-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.feedback-page-drop-actions button {
  appearance: none;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 999px;
  padding: 7px 14px;
  background: rgba(22, 27, 34, 0.95);
  color: #e6edf3;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.feedback-page-drop-actions button[data-drop-kind="bug"] {
  border-color: rgba(210, 153, 34, 0.55);
  color: #ffa657;
}

.feedback-page-drop-actions button[data-drop-kind="suggestion"] {
  border-color: rgba(63, 185, 80, 0.55);
  color: #3fb950;
}

body.feedback-page-dragging {
  cursor: copy;
}

@media (max-width: 640px) {
  .feedback-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Management / Admin dashboard ─────────────────────────────────────── */
.admin-dashboard-page .info-content.admin-dashboard {
  max-width: 1180px;
}

.admin-view-toolbar {
  position: sticky;
  top: 48px;
  z-index: 20;
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.96), rgba(13, 17, 23, 0.92)),
    var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  overflow-x: auto;
  scrollbar-width: thin;
}

.admin-view-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-width: 112px;
  padding: 9px 11px;
  border: 1px solid rgba(139, 148, 158, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.admin-view-tab strong {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.15;
}

.admin-view-tab small {
  color: inherit;
  font-size: 0.64rem;
  white-space: nowrap;
}

.admin-view-tab:hover {
  color: #a5d6ff;
  border-color: rgba(88, 166, 255, 0.42);
  background: rgba(56, 139, 253, 0.12);
  transform: translateY(-1px);
}

.admin-view-tab.active {
  border-color: rgba(251, 133, 0, 0.58);
  background:
    radial-gradient(circle at 0% 0%, rgba(251, 133, 0, 0.18), transparent 58%),
    rgba(251, 133, 0, 0.12);
  color: #ffa657;
}

.admin-view-tab.active strong {
  color: #ffa657;
}

.admin-dashboard [id^="admin-section-"] {
  scroll-margin-top: 118px;
}

.admin-hero-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 179, 0, 0.08), rgba(13, 17, 23, 0.2));
}

.admin-hero-card h2 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.admin-stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.admin-stat-card span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.admin-stat-card strong {
  font-size: 1.45rem;
  line-height: 1.1;
}

.admin-stat-card small {
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.admin-grid--wide-left {
  grid-template-columns: 1.4fr 1fr;
}

.admin-grid--wide-right {
  grid-template-columns: 1fr 1.4fr;
}

.admin-panel {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.admin-panel h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.admin-subhead {
  margin: 18px 0 10px !important;
}

.admin-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
}

.admin-pill em {
  font-style: normal;
  color: var(--accent);
  font-weight: 700;
}

.admin-panel--agent-activity {
  display: grid;
  gap: 14px;
}

.admin-agent-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.admin-agent-head h3 {
  margin-bottom: 6px;
}

.admin-agent-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-agent-controls {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.08), transparent 42%),
    rgba(1, 4, 9, 0.28);
}

.admin-agent-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-agent-filter-group > span {
  min-width: 42px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-agent-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #c9d1d9;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.admin-agent-filter:hover {
  border-color: rgba(88, 166, 255, 0.5);
  color: #e6edf3;
  transform: translateY(-1px);
}

.admin-agent-filter.active {
  border-color: rgba(88, 166, 255, 0.62);
  background: rgba(56, 139, 253, 0.16);
  color: #a5d6ff;
}

.admin-agent-filter em {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(1, 4, 9, 0.42);
  color: inherit;
  font-style: normal;
  text-align: center;
}

.admin-agent-activity-list {
  display: grid;
  gap: 10px;
}

.admin-agent-activity-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-left: 4px solid rgba(88, 166, 255, 0.55);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.78), rgba(13, 17, 23, 0.72)),
    rgba(255, 255, 255, 0.025);
}

.admin-agent-activity-row--render {
  border-left-color: #d2a8ff;
}

.admin-agent-activity-row--v2 {
  border-left-color: #f0c040;
}

.admin-agent-activity-row--wiring {
  border-left-color: #3fb950;
}

.admin-agent-activity-row--rigging {
  border-left-color: #fb8500;
}

.admin-agent-activity-row--general {
  border-left-color: #58a6ff;
}

.admin-agent-activity-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.admin-agent-activity-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-agent-activity-person strong,
.admin-agent-activity-person span {
  display: block;
}

.admin-agent-activity-person strong {
  color: #e6edf3;
  font-size: 0.9rem;
}

.admin-agent-activity-person div span {
  color: var(--muted);
  font-size: 0.74rem;
  word-break: break-word;
}

.admin-agent-avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #a5d6ff;
  background: rgba(56, 139, 253, 0.16);
  border: 1px solid rgba(88, 166, 255, 0.28);
  font-weight: 900;
}

.admin-agent-activity-q {
  margin: 0;
  color: #f0f6fc;
  font-size: clamp(0.96rem, 1.8vw, 1.12rem);
  line-height: 1.42;
  word-break: break-word;
}

.admin-agent-activity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-agent-activity-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(139, 148, 158, 0.1);
  color: #8b949e;
  font-size: 0.7rem;
  font-weight: 750;
}

.admin-agent-activity-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.admin-agent-empty {
  padding: 14px;
  border: 1px dashed rgba(139, 148, 158, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

@media (max-width: 720px) {
  .admin-agent-head,
  .admin-agent-activity-row {
    flex-direction: column;
  }

  .admin-agent-head .btn {
    align-self: flex-start;
  }

  .admin-agent-filter-group {
    align-items: flex-start;
  }

  .admin-agent-filter-group > span {
    width: 100%;
  }

  .admin-agent-activity-meta {
    white-space: normal;
  }
}

.admin-feedback-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-feedback-row {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.admin-feedback-row--bug {
  border-color: rgba(248, 81, 73, 0.38);
}

.admin-feedback-row--suggestion {
  border-color: rgba(88, 166, 255, 0.32);
}

.admin-feedback-row--new-user {
  border-color: rgba(251, 133, 0, 0.32);
  background:
    radial-gradient(circle at 0% 0%, rgba(251, 133, 0, 0.1), transparent 36%),
    rgba(13, 17, 23, 0.74);
}

.admin-alert-tabs {
  display: inline-flex;
  gap: 5px;
  padding: 4px;
  margin: 0 0 14px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 999px;
  background: rgba(1, 4, 9, 0.52);
}

.admin-alert-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.admin-alert-tab.active {
  background: linear-gradient(135deg, #fb8500, #ffa657);
  color: #0d1117;
}

.admin-alert-tab:not(.active):hover {
  color: var(--text);
  background: rgba(56, 139, 253, 0.12);
}

.admin-feedback-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-feedback-head strong,
.admin-feedback-head span {
  display: block;
}

.admin-feedback-status,
.admin-feedback-unread {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.12);
  color: #79c0ff;
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-feedback-unread {
  display: inline-flex !important;
  margin-left: 6px;
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.14);
  color: #ff7b72;
}

.admin-feedback-details {
  margin-top: 8px;
}

.admin-feedback-details summary {
  cursor: pointer;
  color: #79c0ff;
  font-size: 0.78rem;
  font-weight: 650;
}

.admin-feedback-shot-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #79c0ff;
  font: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.admin-feedback-shot-link:hover,
.admin-feedback-shot-link:focus-visible {
  color: #a5d6ff;
  outline: none;
}

.admin-feedback-details pre {
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(139, 148, 158, 0.25);
  background: #010409;
  color: #c9d1d9;
  font-size: 0.72rem;
  white-space: pre-wrap;
}

.admin-feedback-admin-messages {
  display: grid;
  gap: 7px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.admin-feedback-admin-messages li {
  padding: 8px 10px;
  border: 1px solid rgba(88, 166, 255, 0.22);
  border-radius: 9px;
  background: rgba(56, 139, 253, 0.08);
}

.admin-feedback-admin-messages strong,
.admin-feedback-admin-messages span,
.admin-feedback-admin-messages small {
  display: block;
}

.admin-feedback-admin-messages span {
  margin: 3px 0;
}

.admin-feedback-admin-messages small {
  color: var(--muted);
  font-size: 0.68rem;
}

.admin-daily-chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  min-height: 140px;
  padding-top: 8px;
}

.admin-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.admin-chart-views {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-chart-view-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}

.admin-chart-view-btn.active,
.admin-chart-view-btn:hover {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(56, 139, 253, 0.12);
}

.admin-chart-series {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-chart-series-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.admin-chart-series-toggle i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.admin-chart-canvas-wrap {
  position: relative;
  border: 1px solid rgba(139, 148, 158, 0.25);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at top, rgba(56, 139, 253, 0.08), transparent 55%),
    rgba(1, 4, 9, 0.35);
  overflow: hidden;
  min-height: 260px;
}

.admin-chart-svg {
  width: 100%;
  height: 260px;
  display: block;
}

.admin-chart-grid {
  stroke: rgba(139, 148, 158, 0.18);
  stroke-width: 1;
}

.admin-chart-axis {
  fill: #8b949e;
  font-size: 10px;
}

.admin-chart-bar,
.admin-chart-dot {
  transition: opacity 0.15s ease;
}

.admin-chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  background: rgba(13, 17, 23, 0.96);
  color: var(--text);
  font-size: 0.75rem;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-chart-tooltip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.admin-chart-tooltip i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.admin-chart-meta {
  margin-top: 8px;
}

.admin-panel--network {
  margin-bottom: 16px;
}

.admin-network {
  position: relative;
}

.admin-network-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.admin-network-canvas {
  width: 100%;
  height: 380px;
  border-radius: 12px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  background:
    radial-gradient(circle at 50% 45%, rgba(56, 139, 253, 0.12), transparent 42%),
    radial-gradient(circle at 30% 70%, rgba(63, 185, 80, 0.08), transparent 40%),
    #010409;
  cursor: default;
}

.admin-network-tip {
  position: absolute;
  z-index: 4;
  min-width: 140px;
  max-width: 220px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  background: rgba(13, 17, 23, 0.96);
  color: var(--text);
  font-size: 0.75rem;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.admin-day i {
  display: block;
  width: 100%;
  max-width: 18px;
  border-radius: 4px 4px 0 0;
}

.admin-day i.prompts { background: #58a6ff; }
.admin-day i.projects { background: #3fb950; }
.admin-day i.users { background: #ffb300; }

.admin-day span {
  font-size: 0.62rem;
  color: var(--muted);
}

.admin-legend {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.admin-legend i.prompts { background: #58a6ff; }
.admin-legend i.projects { background: #3fb950; }
.admin-legend i.users { background: #ffb300; }

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-list--prompts {
  max-height: 520px;
  overflow: auto;
}

.admin-user-row,
.admin-project-row,
.admin-prompt-row {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.admin-row--clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.admin-row--clickable:hover {
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(56, 139, 253, 0.08);
}

.admin-project-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.admin-project-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.85) center/cover no-repeat;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.admin-project-thumb.has-image .admin-thumb-fallback {
  display: none;
}

.admin-thumb-fallback {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.admin-project-main {
  min-width: 0;
}

.admin-project-prompt {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.admin-ready-tag {
  font-style: normal;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  color: #7ee787;
  border: 1px solid rgba(46, 160, 67, 0.35);
  background: rgba(46, 160, 67, 0.12);
}

.admin-preview-btn {
  white-space: nowrap;
}

.admin-panel-hint {
  margin: -6px 0 12px;
}

.admin-lookup-panel {
  margin-bottom: 16px;
}

.admin-lookup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-lookup-head h3 {
  margin: 0;
}

.admin-user-search {
  min-width: min(280px, 100%);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.55);
  color: var(--text);
}

.admin-list--lookup {
  max-height: 280px;
  overflow: auto;
  margin-bottom: 12px;
}

.admin-user-detail {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.admin-user-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-user-detail-head h3 {
  margin: 0 0 4px;
}

.admin-stats-grid--compact {
  margin-bottom: 10px;
}

.admin-compare {
  margin-bottom: 14px;
}

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(1, 4, 9, 0.72);
  display: grid;
  place-items: center;
  padding: 18px;
}

.admin-modal {
  width: min(1100px, 100%);
  max-height: min(860px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 14px;
  background: #0d1117;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.admin-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.22);
}

.admin-modal-head h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.admin-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 16px;
  padding: 16px 18px 20px;
}

.admin-modal-viewer-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 360px;
}

.admin-modal-viewer {
  flex: 1 1 auto;
  min-height: 360px;
  height: 420px;
  border-radius: 12px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  background: #010409;
  overflow: hidden;
  position: relative;
}

.admin-modal-stats {
  padding: 0 18px;
}

.admin-modal-stats-grid {
  margin: 12px 0 0;
}

.admin-viewer-fallback-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #010409;
}

.admin-modal-side .admin-list--prompts {
  max-height: 420px;
  overflow: auto;
}

.admin-viewer-empty {
  padding: 24px;
}

.admin-modal-snaps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-modal-snaps img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(139, 148, 158, 0.25);
  background: #161b22;
}

.admin-modal-side h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.admin-prompt-row--error {
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.06);
}

.admin-user-row > div:first-child,
.admin-project-main > div:first-child,
.admin-prompt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.admin-user-row span,
.admin-project-main span,
.admin-prompt-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-row-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.admin-row-stats span {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.25);
}

.admin-user-row small,
.admin-project-main small,
.admin-prompt-row small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.admin-prompt-row p {
  margin: 6px 0;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .admin-view-toolbar {
    top: 44px;
    gap: 6px;
    margin-left: -2px;
    margin-right: -2px;
    padding: 7px;
  }

  .admin-view-tab {
    min-width: 96px;
    padding: 8px 9px;
  }

  .admin-project-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .admin-preview-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .admin-modal-body {
    grid-template-columns: 1fr;
  }

  .admin-grid,
  .admin-grid--wide-left,
  .admin-grid--wide-right {
    grid-template-columns: 1fr;
  }

  .admin-hero-card {
    flex-direction: column;
  }
}

/* ── Render Agent assistant panel ─────────────────────────────────────────── */

.render-agent-panel {
  position: fixed;
  right: 14px;
  top: 52px;
  z-index: 10120;
  width: min(360px, calc(100% - 28px));
  max-height: min(680px, calc(100% - 76px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(139, 148, 158, 0.34);
  border-radius: 14px;
  background: rgba(13, 17, 23, 0.96);
  color: var(--text);
  overflow: hidden;
}

.render-agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.22);
}

.render-agent-head-logo {
  width: 94px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.render-agent-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.render-agent-menu-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.94);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.render-agent-menu-btn span {
  display: block;
  width: 14px;
  height: 2px;
  margin: 0;
  border-radius: 999px;
  background: var(--text);
}

.render-agent-title {
  flex: 1 1 auto;
  min-width: 0;
}

.render-agent-title strong,
.render-agent-title span {
  display: block;
}

.render-agent-title span {
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 2px;
}

.render-agent-thread-popover {
  position: absolute;
  top: 52px;
  left: 12px;
  right: 12px;
  z-index: 2;
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.98);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
  padding: 8px;
}

.render-agent-thread-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  margin-bottom: 8px;
}

.render-agent-thread-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-bottom: 8px;
}

.render-agent-thread-search {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.94);
  color: var(--text);
  padding: 7px 9px;
}

.render-agent-thread-folder {
  display: grid;
  gap: 6px;
}

.render-agent-thread-folder + .render-agent-thread-folder {
  margin-top: 8px;
}

.render-agent-thread-folder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 2px 0;
}

.render-agent-thread-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: stretch;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.48);
  padding: 5px;
}

.render-agent-thread-card.active {
  border-color: rgba(88, 166, 255, 0.6);
  background: rgba(56, 139, 253, 0.12);
}

.render-agent-thread-item {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px;
  cursor: pointer;
}

.render-agent-thread-item span,
.render-agent-thread-item small {
  display: block;
}

.render-agent-thread-item small {
  color: var(--muted);
  margin-top: 2px;
}

.render-agent-thread-folder-select {
  display: grid;
  gap: 2px;
  align-content: center;
  color: var(--muted);
  font-size: 0.68rem;
}

.render-agent-thread-folder-select select {
  max-width: 118px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.94);
  color: var(--text);
  padding: 5px 6px;
  font-size: 0.72rem;
}

.render-agent-people-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.16);
}

.render-agent-members {
  display: flex;
  align-items: center;
  min-width: 40px;
}

.render-agent-member-avatar,
.render-agent-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.38);
  background: rgba(88, 166, 255, 0.2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.render-agent-member-avatar + .render-agent-member-avatar {
  margin-left: -7px;
}

.render-agent-logo-avatar {
  width: 36px;
  height: 24px;
  border-radius: 6px;
  border: 0;
  background-color: transparent !important;
  background-size: contain !important;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: none;
}

.render-agent-invite-select {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  padding: 6px 8px;
}

.render-agent-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(139, 148, 158, 0.16);
  background: rgba(13, 17, 23, 0.28);
}

.render-agent-source-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.render-agent-source-select {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(22, 27, 34, 0.94);
  color: var(--text);
  padding: 5px 9px;
  font-size: 0.76rem;
}

.render-agent-source-hint {
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.render-agent-invite-picker {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.render-agent-invite-trigger {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.94);
  color: var(--text);
  padding: 6px 9px;
  text-align: left;
  cursor: pointer;
}

.render-agent-invite-trigger span,
.render-agent-invite-trigger small {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.render-agent-invite-trigger small {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 1px;
}

.render-agent-invite-popover {
  position: absolute;
  z-index: 25;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  padding: 8px;
}

.render-agent-invite-search {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.94);
  color: var(--text);
  padding: 7px 9px;
  margin-bottom: 7px;
}

.render-agent-invite-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.render-agent-invite-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(139, 148, 158, 0.2);
  border-radius: 9px;
  background: rgba(22, 27, 34, 0.58);
  color: var(--text);
  padding: 7px;
  text-align: left;
  cursor: pointer;
}

.render-agent-invite-option:hover,
.render-agent-invite-option.active {
  border-color: rgba(88, 166, 255, 0.58);
  background: rgba(56, 139, 253, 0.16);
}

.render-agent-invite-option span,
.render-agent-invite-option strong,
.render-agent-invite-option small {
  display: block;
  min-width: 0;
}

.render-agent-invite-option strong,
.render-agent-invite-option small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.render-agent-invite-option small {
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 2px;
}

.render-agent-invite-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 166, 255, 0.18);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.render-agent-onboarding {
  margin: 10px 12px 0;
  padding: 10px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 10px;
  background: rgba(56, 139, 253, 0.1);
}

.render-agent-onboarding strong,
.render-agent-onboarding span {
  display: block;
}

.render-agent-onboarding span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.render-agent-messages {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.render-agent-empty {
  border: 1px dashed rgba(139, 148, 158, 0.38);
  border-radius: 10px;
  padding: 14px;
  color: var(--muted);
}

.render-agent-empty strong,
.render-agent-empty span {
  display: block;
}

.render-agent-empty span {
  margin-top: 4px;
  font-size: 0.78rem;
}

.render-agent-tip {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(56, 139, 253, 0.12), rgba(22, 27, 34, 0.55));
  color: var(--text, #e6edf3);
}

.render-agent-tip--compact {
  margin: 0 0 12px;
  padding: 10px 12px;
}

.render-agent-tip--compact .render-agent-tip-body {
  margin: 4px 0 8px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.render-agent-tip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.render-agent-tip-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.render-agent-tip-badge.tip-topic--prompt {
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.16);
  border-color: rgba(88, 166, 255, 0.35);
}

.render-agent-tip-badge.tip-topic--dxf {
  color: #7ee787;
  background: rgba(46, 160, 67, 0.14);
  border-color: rgba(46, 160, 67, 0.35);
}

.render-agent-tip-badge.tip-topic--software {
  color: #d2a8ff;
  background: rgba(163, 113, 247, 0.14);
  border-color: rgba(163, 113, 247, 0.35);
}

.render-agent-tip-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.render-agent-tip-title {
  display: block;
  font-size: 0.9rem;
  line-height: 1.3;
}

.render-agent-tip-body {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.render-agent-tip-try {
  width: fit-content;
}

body.theme-light .render-agent-tip {
  background: linear-gradient(160deg, rgba(56, 139, 253, 0.08), rgba(255, 255, 255, 0.9));
  border-color: rgba(9, 105, 218, 0.22);
}

.render-agent-message {
  border: 1px solid rgba(139, 148, 158, 0.2);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(22, 27, 34, 0.92);
  line-height: 1.45;
  font-size: 0.84rem;
}

.render-agent-message--user {
  border-color: rgba(88, 166, 255, 0.34);
  background: rgba(56, 139, 253, 0.12);
}

.render-agent-message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.render-agent-message-head small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  margin-top: 1px;
}

.render-agent-message-content {
  padding-left: 42px;
}

.render-agent-message-content p {
  margin: 0 0 9px;
}

.render-agent-message-content p:last-child,
.render-agent-message-content .render-agent-rich-list:last-child,
.render-agent-message-content .render-agent-prompt-card:last-child,
.render-agent-message-content .render-agent-cue:last-child {
  margin-bottom: 0;
}

.render-agent-message-content strong {
  color: #f0f6fc;
  font-weight: 800;
}

.render-agent-message-content code {
  padding: 1px 5px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 6px;
  background: rgba(1, 4, 9, 0.48);
  color: #c9d1d9;
  font-size: 0.82em;
}

.render-agent-rich-heading {
  margin: 12px 0 7px;
  color: #f0f6fc;
  font-size: 0.92rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.render-agent-rich-heading:first-child {
  margin-top: 0;
}

.render-agent-rich-list {
  margin: 0 0 10px;
  padding-left: 22px;
  color: #c9d1d9;
}

.render-agent-rich-list li {
  margin: 4px 0;
}

.render-agent-prompt-card {
  position: relative;
  margin: 8px 0 12px;
  padding: 10px 12px 11px;
  border: 1px solid rgba(249, 115, 22, 0.36);
  border-radius: 12px;
  background:
    radial-gradient(circle at 12% 0%, rgba(249, 115, 22, 0.18), transparent 40%),
    linear-gradient(145deg, rgba(22, 27, 34, 0.96), rgba(13, 17, 23, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.render-agent-prompt-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(#f97316, #fbbf24);
}

.render-agent-prompt-card-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.render-agent-prompt-card p {
  margin: 0;
  color: #f0f6fc;
  font-size: 0.82rem;
  line-height: 1.45;
}

.render-agent-cue {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 11px;
  background: rgba(56, 139, 253, 0.1);
  color: #dbeafe;
}

.render-agent-cue-icon {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 18px;
  margin-top: 1px;
}

.render-agent-cue-icon::before,
.render-agent-cue-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.render-agent-cue-icon::before {
  left: 1px;
  width: 15px;
  height: 3px;
  border-radius: 999px;
  background: #58a6ff;
  animation: render-agent-cue-slide 1.25s ease-in-out infinite;
}

.render-agent-cue-icon::after {
  right: 2px;
  width: 8px;
  height: 8px;
  border-top: 3px solid #58a6ff;
  border-right: 3px solid #58a6ff;
  transform: translateY(-50%) rotate(45deg);
  animation: render-agent-cue-tip 1.25s ease-in-out infinite;
}

@keyframes render-agent-cue-slide {
  0%, 100% { transform: translate(0, -50%); opacity: 0.65; }
  50% { transform: translate(5px, -50%); opacity: 1; }
}

@keyframes render-agent-cue-tip {
  0%, 100% { transform: translate(0, -50%) rotate(45deg); opacity: 0.65; }
  50% { transform: translate(5px, -50%) rotate(45deg); opacity: 1; }
}

.render-agent-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
}

.render-agent-attachment {
  max-width: 100%;
  border: 1px solid rgba(139, 148, 158, 0.3);
  border-radius: 999px;
  background: rgba(22, 27, 34, 0.9);
  color: var(--text);
  padding: 5px 8px;
  display: inline-flex;
  gap: 6px;
  cursor: pointer;
}

.render-agent-attachment small {
  color: var(--muted);
}

.render-agent-form {
  border-top: 1px solid rgba(139, 148, 158, 0.2);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: end;
}

.render-agent-upload {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.76rem;
}

.render-agent-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 9px 12px 0;
  border-top: 1px solid rgba(139, 148, 158, 0.16);
}

.render-agent-doit-modal {
  position: fixed;
  inset: 0;
  z-index: 22000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.render-agent-doit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.64);
  backdrop-filter: blur(4px);
}

.render-agent-doit-card {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  display: grid;
  gap: 13px;
  padding: 20px;
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 18px;
  background:
    radial-gradient(circle at 16% 0%, rgba(88, 166, 255, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98));
  color: var(--text);
  box-shadow: 0 26px 84px rgba(0, 0, 0, 0.55);
}

.render-agent-doit-card header h2,
.render-agent-doit-card header p {
  margin: 0;
}

.render-agent-doit-card header {
  display: grid;
  gap: 5px;
}

.render-agent-doit-eyebrow {
  color: #79c0ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.render-agent-doit-field,
.render-agent-doit-fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.render-agent-doit-field > span,
.render-agent-doit-fieldset legend {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
}

.render-agent-doit-card textarea,
.render-agent-doit-card select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #010409;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

.render-agent-doit-radio {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.62);
}

.render-agent-doit-radio span,
.render-agent-doit-radio small {
  display: block;
}

.render-agent-doit-radio small,
.render-agent-doit-field small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.render-agent-doit-card footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.render-agent-doit-note {
  position: fixed;
  z-index: 22010;
  width: min(310px, calc(100vw - 28px));
  padding: 13px 14px;
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(249, 115, 22, 0.18), transparent 54%),
    rgba(13, 17, 23, 0.96);
  color: var(--text);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52);
}

.render-agent-doit-note strong,
.render-agent-doit-note p {
  display: block;
  margin: 0;
}

.render-agent-doit-note p {
  margin: 6px 0 11px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.render-agent-doit-target {
  outline: 2px solid rgba(249, 115, 22, 0.92) !important;
  outline-offset: 4px;
  box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.15) !important;
}

.render-agent-form textarea {
  min-width: 0;
  resize: vertical;
  max-height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  padding: 8px;
}

.render-agent-status {
  min-height: 18px;
  padding: 0 12px 10px;
  margin: 0;
}

.render-agent-status.error {
  color: #ff7b72;
}

/* ── Getting Started docs ─────────────────────────────────────────────────── */

.gs-body {
  --gs-display: "Manrope", var(--font);
  --gs-body: "IBM Plex Sans", var(--font);
  --gs-line: rgba(88, 166, 255, 0.18);
  --gs-surface: rgba(22, 27, 34, 0.72);
}

.gs-body .info-main.gs-main {
  padding: 0 0 80px;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(88, 166, 255, 0.14), transparent 60%),
    radial-gradient(700px 380px at 92% 8%, rgba(63, 185, 80, 0.08), transparent 55%),
    linear-gradient(180deg, #0b1017 0%, var(--bg) 38%, #0b1017 100%);
}

.gs-page {
  max-width: min(1180px, 100%);
  margin: 0 auto;
  width: 100%;
  padding: 0 20px 0 24px;
  font-family: var(--gs-body);
  box-sizing: border-box;
  transition: max-width 0.22s ease, margin 0.22s ease, padding 0.22s ease;
}

body.gs-agent-open .gs-page {
  margin-left: 0;
  margin-right: 0;
}

@media (min-width: 981px) {
  body.gs-agent-open .gs-page {
    /* Reach nearly to the bottom-right agent panel instead of leaving a wide empty column. */
    max-width: none;
    width: calc(100% - 436px);
  }
}

.gs-hero {
  position: relative;
  display: block;
  min-height: 0;
  padding: 14px min(42vw, 480px) 8px 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.gs-hero.is-visible {
  opacity: 1;
  transform: none;
}

.gs-hero-copy {
  position: relative;
  z-index: 2;
  max-width: min(520px, calc(100% - min(42vw, 460px)));
}

.gs-kicker {
  margin: 0 0 10px;
  font-family: var(--gs-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #79b8ff;
}

.gs-hero-title {
  margin: 0 0 10px;
  font-family: var(--gs-display);
  font-size: clamp(2.1rem, 4.2vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.98;
  color: #f0f3f6;
}

.gs-hero-lead {
  margin: 0 0 16px;
  max-width: 34ch;
  font-size: 1rem;
  line-height: 1.5;
  color: #9da7b3;
}

.gs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gs-hero-visual {
  position: absolute;
  left: auto;
  right: clamp(-12px, -1vw, 0px);
  top: 8px;
  width: clamp(220px, 34vw, 420px);
  min-height: 160px;
  height: clamp(160px, 22vw, 280px);
  border: 0;
  overflow: hidden;
  border-radius: 0;
  background: #0d1117;
  isolation: isolate;
  z-index: 0;
  pointer-events: none;
}

.gs-hero-frame {
  position: absolute;
  inset: -8% -6% -12% -4%;
  width: auto;
  height: auto;
  border: 0;
  display: block;
  background: #0d1117;
  color-scheme: dark;
  pointer-events: none;
  transform: translate(8%, 4%) scale(1.08);
  transform-origin: right center;
}

.gs-hero-gif {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  max-height: 620px;
  object-fit: cover;
  object-position: left center;
  opacity: 0.92;
}

.gs-hero-visual-fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: transparent;
  z-index: 1;
}

.gs-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-top: 4px;
}

.gs-toc {
  position: sticky;
  top: 68px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 2px 10px 8px 0;
  max-height: none;
  overflow: visible;
}

.gs-toc-title {
  margin: 0 0 12px;
  font-family: var(--gs-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #7d8590;
}

.gs-toc a {
  position: relative;
  display: block;
  margin: 1px 0;
  padding: 5px 8px 5px 13px;
  font-size: 0.82rem;
  line-height: 1.28;
  color: #9da7b3;
  text-decoration: none;
  border-left: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 0 8px 8px 0;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.gs-toc a:hover,
.gs-toc a.is-active {
  color: #e6edf3;
  border-left-color: #58a6ff;
  background: rgba(88, 166, 255, 0.09);
}

.gs-toc a.is-active {
  font-weight: 650;
}

.gs-toc-docs {
  margin: 0 0 14px !important;
  padding: 8px 10px !important;
  border: 1px solid rgba(88, 166, 255, 0.28) !important;
  border-radius: 9px !important;
  background: rgba(88, 166, 255, 0.08);
  color: #dbeafe !important;
  font-weight: 650;
}

.gs-toc-group {
  margin: 0 0 14px;
}

.gs-toc-group-title {
  margin: 0 0 4px;
  padding-left: 13px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
  color: #8b949e;
}

.gs-stream {
  min-width: 0;
}

.gs-features {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gs-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  grid-template-areas: "media copy";
  gap: 32px;
  align-items: center;
  padding: 24px 0;
  border-top: 1px solid rgba(48, 54, 61, 0.7);
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  scroll-margin-top: 82px;
}

.gs-feature.is-visible {
  opacity: 1;
  transform: none;
}

.gs-feature-media { grid-area: media; min-width: 0; }
.gs-feature-copy { grid-area: copy; min-width: 0; }

.gs-feature--flip {
  grid-template-areas: "copy media";
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
}

.gs-feature-index {
  margin: 0 0 8px;
  font-family: var(--gs-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #58a6ff;
}

.gs-feature-copy h3 {
  margin: 0 0 10px;
  font-family: var(--gs-display);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  border: 0;
  padding: 0;
}

.gs-summary {
  margin: 0 0 18px;
  color: #9da7b3;
  line-height: 1.55;
  font-size: 0.98rem;
}

.gs-steps {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  counter-reset: gs-step;
  display: grid;
  gap: 10px;
}

.gs-steps li {
  position: relative;
  padding-left: 34px;
  color: #d0d7de;
  line-height: 1.45;
  font-size: 0.92rem;
  counter-increment: gs-step;
}

.gs-steps li::before {
  content: counter(gs-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-family: var(--gs-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: #79b8ff;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.08);
}

.gs-ask-btn {
  display: inline-flex;
}

.gs-demo {
  position: relative;
  overflow: hidden;
  background: #010409;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(88, 166, 255, 0.16);
  transition: border-color 0.2s ease, transform 0.35s ease;
}

.gs-feature.is-visible .gs-demo {
  animation: gs-demo-in 0.7s ease both;
}

.gs-demo:hover {
  border-color: rgba(88, 166, 255, 0.38);
  transform: translateY(-2px);
}

@keyframes gs-demo-in {
  from { opacity: 0.35; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}

.gs-demo-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  background: #010409;
}

.gs-demo.has-gif .gs-demo-stage {
  opacity: 0;
  pointer-events: none;
}

.gs-demo-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
}

.gs-demo-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: #8b949e;
}

.gs-demo-chrome span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #484f58;
}

.gs-demo-chrome em {
  margin-left: 6px;
  font-style: normal;
}

.gs-demo-body {
  position: relative;
  flex: 1;
  border: 1px solid rgba(139, 148, 158, 0.2);
  background: linear-gradient(160deg, #161b22, #0d1117);
}

.gs-demo-label {
  margin: 8px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e7681;
}

/* Shared GIF expand (+) — Getting Started / Docs / Updates */
.docs-gif-frame,
.gs-demo,
.docs-feature-gif-wrap,
.updates-visual {
  position: relative;
}

.docs-gif-expand-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(230, 237, 243, 0.22);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.78);
  color: #e6edf3;
  box-shadow: 0 8px 22px rgba(1, 4, 9, 0.45);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.docs-gif-expand-btn:hover,
.docs-gif-expand-btn:focus-visible {
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(88, 166, 255, 0.55);
  background: rgba(22, 27, 34, 0.92);
  color: #79c0ff;
  outline: none;
}

.docs-gif-lightbox {
  position: fixed;
  inset: 0;
  z-index: 22000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.docs-gif-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.78);
  backdrop-filter: blur(6px);
}

.docs-gif-lightbox-card {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 16px;
  background:
    radial-gradient(circle at 12% 0%, rgba(88, 166, 255, 0.14), transparent 34%),
    rgba(13, 17, 23, 0.98);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.docs-gif-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.85);
}

.docs-gif-lightbox-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #e6edf3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-gif-lightbox-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(139, 148, 158, 0.35);
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.9);
  color: #e6edf3;
  cursor: pointer;
}

.docs-gif-lightbox-close:hover,
.docs-gif-lightbox-close:focus-visible {
  border-color: rgba(88, 166, 255, 0.5);
  color: #79c0ff;
  outline: none;
}

.docs-gif-lightbox-media {
  padding: 12px;
  overflow: auto;
  background: #010409;
}

.docs-gif-lightbox-media img {
  display: block;
  width: 100%;
  max-height: min(78vh, 820px);
  object-fit: contain;
  margin: 0 auto;
  border-radius: 8px;
  background: #0d1117;
}

body.docs-gif-lightbox-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .docs-gif-expand-btn {
    width: 32px;
    height: 32px;
    right: 8px;
    bottom: 8px;
  }

  .docs-gif-lightbox {
    padding: 10px;
  }

  .docs-gif-lightbox-media img {
    max-height: min(72vh, 640px);
  }
}

.gs-closing {
  margin-top: 8px;
  padding: 40px 0 12px;
  border-top: 1px solid rgba(48, 54, 61, 0.7);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.gs-closing.is-visible {
  opacity: 1;
  transform: none;
}

.gs-closing h3 {
  margin: 0 0 8px;
  font-family: var(--gs-display);
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  border: 0;
  padding: 0;
}

.gs-closing p {
  margin: 0 0 18px;
  color: #9da7b3;
  max-width: 42ch;
}

.gs-tips-section {
  padding: 44px 0;
  border-top: 1px solid rgba(48, 54, 61, 0.7);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  scroll-margin-top: 82px;
}

.gs-tips-section.is-visible {
  opacity: 1;
  transform: none;
}

.gs-tips-section h3 {
  margin: 0 0 10px;
  font-family: var(--gs-display);
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  border: 0;
  padding: 0;
}

.gs-tips-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  gap: 18px;
  align-items: start;
  padding: 18px;
  border: 1px solid rgba(88, 166, 255, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 14% 0%, rgba(88, 166, 255, 0.14), transparent 38%),
    linear-gradient(135deg, rgba(13, 17, 23, 0.72), rgba(22, 27, 34, 0.54));
}

.gs-tips-tabs {
  justify-content: flex-end;
  margin: 0;
}

.gs-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.gs-tip-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(88, 166, 255, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.82), rgba(13, 17, 23, 0.86)),
    radial-gradient(circle at 10% 0%, rgba(88, 166, 255, 0.12), transparent 36%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.gs-tip-card:hover {
  transform: translateY(-2px);
  border-color: rgba(88, 166, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.92), rgba(13, 17, 23, 0.9)),
    radial-gradient(circle at 10% 0%, rgba(88, 166, 255, 0.18), transparent 40%);
}

.gs-tip-thumb {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  border: 1px solid rgba(139, 148, 158, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(rgba(88, 166, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 30% 16%, rgba(88, 166, 255, 0.22), transparent 40%),
    #0d1117;
  background-size: 24px 24px, 24px 24px, auto, auto;
}

.gs-tip-thumb::after {
  content: "";
  position: absolute;
  right: -26px;
  top: -30px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.18);
  filter: blur(2px);
}

.gs-tip-thumb-glyph {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 58px;
  height: 42px;
  padding: 0 10px;
  border-radius: 14px;
  background: rgba(1, 4, 9, 0.6);
  color: #f0f6fc;
  font-family: var(--gs-display);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.gs-tip-thumb-label {
  position: absolute;
  left: 16px;
  top: 14px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.14);
  color: #79b8ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.gs-tip-card--drawing .gs-tip-thumb,
.gs-tip-card--markup .gs-tip-thumb {
  background:
    linear-gradient(rgba(253, 186, 116, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(253, 186, 116, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 70% 20%, rgba(249, 115, 22, 0.24), transparent 38%),
    #111827;
  background-size: 22px 22px, 22px 22px, auto, auto;
}

.gs-tip-card--software .gs-tip-thumb,
.gs-tip-card--cloud .gs-tip-thumb {
  background:
    radial-gradient(circle at 22% 20%, rgba(163, 113, 247, 0.26), transparent 40%),
    linear-gradient(135deg, rgba(22, 27, 34, 0.95), rgba(30, 41, 59, 0.92));
}

.gs-tip-card--files .gs-tip-thumb,
.gs-tip-card--collab .gs-tip-thumb {
  background:
    radial-gradient(circle at 18% 18%, rgba(63, 185, 80, 0.2), transparent 42%),
    linear-gradient(135deg, rgba(13, 17, 23, 0.95), rgba(20, 83, 45, 0.26));
}

.gs-tip-card--geometry .gs-tip-thumb,
.gs-tip-card--editing .gs-tip-thumb,
.gs-tip-card--wiring .gs-tip-thumb {
  background:
    radial-gradient(circle at 18% 20%, rgba(88, 166, 255, 0.24), transparent 40%),
    radial-gradient(circle at 82% 70%, rgba(249, 115, 22, 0.2), transparent 42%),
    #0d1117;
}

.gs-tip-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
}

.gs-tip-topic {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #79b8ff;
}

.gs-tip-card h4 {
  margin: 0;
  font-family: var(--gs-display);
  font-size: 1rem;
  font-weight: 750;
  color: #f0f3f6;
}

.gs-tip-card p {
  margin: 0;
  color: #c9d1d9;
  line-height: 1.45;
  font-size: 0.88rem;
}

.gs-tip-steps {
  margin: 0;
  padding-left: 18px;
  color: #9da7b3;
  font-size: 0.82rem;
  line-height: 1.45;
}

.gs-tip-steps li + li {
  margin-top: 5px;
}

.gs-tip-ask {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 12px;
  background: rgba(88, 166, 255, 0.09);
  color: #dbeafe;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.gs-tip-ask span,
.gs-tip-ask small {
  display: block;
}

.gs-tip-ask span {
  font-size: 0.82rem;
  font-weight: 800;
}

.gs-tip-ask small {
  color: #8b949e;
  font-size: 0.7rem;
}

.gs-tip-ask:hover,
.gs-tip-ask:focus-visible {
  border-color: rgba(88, 166, 255, 0.58);
  background: rgba(88, 166, 255, 0.16);
  outline: none;
}

@media (max-width: 980px) {
  .gs-page {
    max-width: 100%;
    padding: 0 20px;
  }

  .gs-shell {
    grid-template-columns: 1fr;
  }

  .gs-toc {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px 14px;
    max-height: none;
    padding: 0 0 12px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.7);
  }

  .gs-toc-title {
    grid-column: 1 / -1;
    margin-bottom: 2px;
  }

  .gs-toc a {
    padding: 5px 8px 5px 11px;
  }

  .gs-toc a.is-active {
    color: #79b8ff;
  }

  .gs-toc-docs {
    grid-column: 1 / -1;
    margin-bottom: 0 !important;
  }

  .gs-toc-group {
    margin-bottom: 0;
  }

  .gs-tips-head {
    grid-template-columns: 1fr;
  }

  .gs-tips-tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .gs-hero {
    display: block;
    min-height: 0;
    padding: 14px 0 0;
  }

  .gs-hero-visual {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    min-height: 280px;
    height: min(52vw, 360px);
    margin: 0 0 8px;
    background: #0d1117;
    mask-image: none;
  }

  .gs-hero-frame {
    inset: -4% -2% 0;
    transform: scale(1.04);
    transform-origin: center center;
    background: #0d1117;
  }

  .gs-hero-gif {
    min-height: 280px;
    max-height: 360px;
  }

  .gs-feature,
  .gs-feature--flip {
    grid-template-columns: 1fr;
    grid-template-areas:
      "media"
      "copy";
  }
}

@media (prefers-reduced-motion: reduce) {
  .gs-hero,
  .gs-feature,
  .gs-tips-section,
  .gs-closing,
  .gs-hero-gif {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Docs category tabs ───────────────────────────────────────────────────── */

.docs-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
}

.docs-category-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  color: #c9d1d9;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.docs-category-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 166, 255, 0.48);
  color: #f0f3f6;
}

.docs-category-tab.active {
  border-color: rgba(88, 166, 255, 0.72);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.24), rgba(46, 160, 67, 0.08));
  color: #d8ebff;
}

.gs-hero-tabs {
  margin-top: 14px;
}

/* ── Show me guided tour ──────────────────────────────────────────────────── */

.show-me-overlay {
  position: fixed;
  inset: 0;
  z-index: 14000;
  pointer-events: none;
}

.show-me-overlay.hidden {
  display: none !important;
}

.show-me-dim {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 9, 0.55);
  pointer-events: none;
  z-index: 14000;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.show-me-circle {
  position: fixed;
  border-radius: 50%;
  border: 3px solid #7ec8ff;
  box-shadow:
    0 0 0 3px rgba(126, 200, 255, 0.35),
    0 0 28px rgba(126, 200, 255, 0.65),
    inset 0 0 18px rgba(126, 200, 255, 0.18);
  pointer-events: none;
  z-index: 14001;
  opacity: 0;
  transform: scale(0.92);
  transition:
    left 0.22s ease,
    top 0.22s ease,
    width 0.22s ease,
    height 0.22s ease,
    opacity 0.18s ease,
    transform 0.22s ease;
}

.show-me-circle.is-on {
  opacity: 1;
  transform: scale(1);
  animation: show-me-circle-glow 1.2s ease-in-out infinite;
}

@keyframes show-me-circle-glow {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(126, 200, 255, 0.35),
      0 0 22px rgba(126, 200, 255, 0.55),
      inset 0 0 14px rgba(126, 200, 255, 0.14);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(126, 200, 255, 0.5),
      0 0 34px rgba(126, 200, 255, 0.8),
      inset 0 0 22px rgba(126, 200, 255, 0.22);
  }
}

.show-me-click {
  position: fixed;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  pointer-events: none;
  z-index: 14004;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.show-me-click.is-on {
  opacity: 1;
  transform: scale(1);
}

.show-me-click-dot {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.95);
  box-shadow: 0 0 8px rgba(88, 166, 255, 0.7);
}

.show-me-click-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(88, 166, 255, 0.85);
  opacity: 0;
}

.show-me-click.is-press .show-me-click-ring {
  animation: show-me-click-pulse 0.55s ease-out;
}

.show-me-click.is-press .show-me-click-dot {
  animation: show-me-click-press 0.35s ease-out;
}

@keyframes show-me-click-pulse {
  0% {
    transform: scale(0.55);
    opacity: 0.95;
  }
  100% {
    transform: scale(1.85);
    opacity: 0;
  }
}

@keyframes show-me-click-press {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.72);
  }
  100% {
    transform: scale(1);
  }
}

.show-me-card {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 28px));
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(13, 17, 23, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: var(--text);
  pointer-events: auto;
  z-index: 14005;
}

.show-me-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.show-me-card-top strong {
  font-size: 0.95rem;
}

.show-me-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.show-me-step {
  margin: 0 0 12px;
  color: #c9d1d9;
  font-size: 0.88rem;
  line-height: 1.45;
}

.show-me-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.show-me-kb-demo {
  position: fixed;
  right: clamp(18px, 5vw, 76px);
  top: clamp(72px, 14vh, 142px);
  z-index: 14004;
  width: min(360px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid rgba(88, 166, 255, 0.38);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 0%, rgba(88, 166, 255, 0.18), transparent 42%),
    radial-gradient(circle at 92% 18%, rgba(249, 115, 22, 0.14), transparent 38%),
    rgba(13, 17, 23, 0.96);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(88, 166, 255, 0.1);
  pointer-events: none;
  animation: show-me-kb-pop 0.36s ease-out;
}

.show-me-kb-demo-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.show-me-kb-demo-head strong {
  display: block;
  color: #e6edf3;
}

.show-me-kb-demo-head small,
.show-me-kb-node small {
  color: #8b949e;
}

.show-me-kb-demo-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #79c0ff;
  font-weight: 900;
  background: rgba(56, 139, 253, 0.16);
  border: 1px solid rgba(88, 166, 255, 0.35);
}

.show-me-kb-demo-flow {
  display: grid;
  gap: 8px;
}

.show-me-kb-node {
  pointer-events: none;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 10px;
  border-radius: 13px;
  border: 1px solid rgba(139, 148, 158, 0.2);
  background: rgba(1, 4, 9, 0.48);
  color: #e6edf3;
  text-align: left;
  transform: translateX(0);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.show-me-kb-node span {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #a5d6ff;
  background: rgba(56, 139, 253, 0.16);
  font-weight: 900;
  font-size: 0.72rem;
}

.show-me-kb-node strong {
  font-size: 0.86rem;
}

.show-me-kb-node.is-active {
  border-color: rgba(88, 166, 255, 0.72);
  background: rgba(56, 139, 253, 0.14);
  transform: translateX(-4px);
  box-shadow: 0 0 28px rgba(88, 166, 255, 0.16);
}

.show-me-kb-demo-stack {
  position: absolute;
  right: 16px;
  top: 14px;
  display: flex;
  gap: 3px;
}

.show-me-kb-demo-stack span {
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(#79c0ff, #fb923c);
  opacity: 0.7;
  animation: show-me-kb-bars 1.2s ease-in-out infinite;
}

.show-me-kb-demo-stack span:nth-child(2) {
  animation-delay: 0.16s;
}

.show-me-kb-demo-stack span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes show-me-kb-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes show-me-kb-bars {
  0%,
  100% {
    transform: scaleY(0.55);
  }
  50% {
    transform: scaleY(1);
  }
}

.show-me-summary {
  position: fixed;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  z-index: 14006;
  width: min(480px, calc(100vw - 32px));
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(88, 166, 255, 0.42);
  background:
    radial-gradient(circle at 16% 0%, rgba(88, 166, 255, 0.2), transparent 38%),
    radial-gradient(circle at 92% 12%, rgba(249, 115, 22, 0.16), transparent 36%),
    rgba(13, 17, 23, 0.97);
  color: #e6edf3;
  pointer-events: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
}

.show-me-summary strong {
  display: block;
  font-size: 1.08rem;
  margin-bottom: 8px;
}

.show-me-summary p {
  margin: 0 0 14px;
  color: #c9d1d9;
  line-height: 1.45;
}

.show-me-summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.show-me-spotlight {
  display: none !important;
}

.show-me-target {
  position: relative;
  z-index: 14003 !important;
}

/* ── Render-to-model material prompt ─────────────────────────────────────── */

.render-texture-modal {
  position: fixed;
  inset: 0;
  z-index: 14100;
  display: grid;
  place-items: center;
  padding: 22px;
}

.render-texture-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(88, 166, 255, 0.16), transparent 34%),
    rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(10px);
}

.render-texture-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(260px, 1.15fr);
  gap: 0;
  width: min(720px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 24px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.18), transparent 36%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.66), inset 0 1px 0 rgba(255,255,255,0.08);
}

.render-texture-preview {
  position: relative;
  min-height: 250px;
  background: #020617;
}

.render-texture-preview.is-unavailable::before {
  content: "Preview unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 0.82rem;
}

.render-texture-preview img {
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
  display: block;
}

.render-texture-preview span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 5px 9px;
  color: #e0f2fe;
  background: rgba(2, 6, 23, 0.72);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.render-texture-copy {
  padding: 24px;
}

.render-texture-eyebrow {
  margin: 0 0 8px;
  color: #7dd3fc;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.render-texture-copy h2 {
  margin: 0 34px 10px 0;
  color: #f8fafc;
  font-size: 1.32rem;
  line-height: 1.15;
}

.render-texture-copy p:not(.render-texture-eyebrow) {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.55;
}

.render-texture-target {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
}

.render-texture-target select {
  width: 100%;
  border: 1px solid rgba(88, 166, 255, 0.28);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.94);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.render-texture-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.render-texture-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  cursor: pointer;
}

@media (max-width: 640px) {
  .render-texture-card {
    grid-template-columns: 1fr;
  }

  .render-texture-preview,
  .render-texture-preview img {
    min-height: 190px;
  }
}

/* ── Render Agent sticky note + media ─────────────────────────────────────── */

.render-agent-panel--sticky {
  resize: none;
  max-height: none;
  height: min(640px, calc(100vh - 80px));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  border-color: rgba(210, 168, 255, 0.28);
}

.render-agent-panel--docs.render-agent-panel--popup,
.render-agent-panel--docs.render-agent-panel--sticky {
  position: fixed;
  z-index: 12050;
  right: 16px;
  top: auto;
  bottom: 24px;
  left: auto;
  width: min(320px, calc(100vw - 24px));
  height: min(460px, calc(100vh - 120px));
  max-height: none;
  border-radius: 16px;
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(210, 168, 255, 0.18);
}

.render-agent-panel--sticky .render-agent-head {
  cursor: grab;
  user-select: none;
}

.render-agent-panel--sticky.is-dragging .render-agent-head {
  cursor: grabbing;
}

.render-agent-drag-hint {
  color: #8b949e;
  font-size: 0.95rem;
  line-height: 1;
  margin-right: 2px;
  cursor: grab;
}

.render-agent-resize {
  position: absolute;
  z-index: 3;
  background: transparent;
}

.render-agent-resize--n,
.render-agent-resize--s {
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: ns-resize;
}

.render-agent-resize--n { top: 0; }
.render-agent-resize--s { bottom: 0; }

.render-agent-resize--e,
.render-agent-resize--w {
  top: 10px;
  bottom: 10px;
  width: 8px;
  cursor: ew-resize;
}

.render-agent-resize--e { right: 0; }
.render-agent-resize--w { left: 0; }

.render-agent-resize--se,
.render-agent-resize--sw,
.render-agent-resize--ne,
.render-agent-resize--nw {
  width: 14px;
  height: 14px;
}

.render-agent-resize--se {
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, rgba(139, 148, 158, 0.75) 50%) no-repeat bottom right / 12px 12px;
}

.render-agent-resize--sw {
  left: 0;
  bottom: 0;
  cursor: nesw-resize;
}

.render-agent-resize--ne {
  right: 0;
  top: 0;
  cursor: nesw-resize;
}

.render-agent-resize--nw {
  left: 0;
  top: 0;
  cursor: nwse-resize;
}

.render-agent-panel--docs .render-agent-people-row--docs {
  display: none;
}

.render-agent-panel--docs .render-agent-form button[type="submit"] {
  border-color: rgba(63, 185, 80, 0.34);
  background: transparent;
  color: #7ee787;
  box-shadow: none;
}

.render-agent-panel--docs .render-agent-form button[type="submit"]:hover,
.render-agent-panel--docs .render-agent-form button[type="submit"]:focus-visible {
  background: rgba(46, 160, 67, 0.12);
  outline: none;
}

.render-agent-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10110;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(139, 148, 158, 0.24);
  background: transparent;
  color: var(--text);
  box-shadow: none;
  backdrop-filter: none;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.render-agent-fab.hidden {
  display: none;
}

.render-agent-fab img {
  width: 46px;
  height: 28px;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.render-agent-media-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 8px;
}

.render-agent-media {
  margin: 0;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 10px;
  overflow: hidden;
  background: #010409;
}

.render-agent-media img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.render-agent-media figcaption {
  padding: 6px 8px;
  font-size: 0.72rem;
  color: #8b949e;
  border-top: 1px solid rgba(139, 148, 158, 0.2);
  display: grid;
  gap: 2px;
}

.render-agent-media figcaption strong {
  color: #e6edf3;
  font-weight: 650;
}

.render-agent-media figcaption span {
  display: block;
  line-height: 1.35;
}

/* ── Recent Updates (milestones) ──────────────────────────────────────────── */

.updates-body .gs-main {
  padding-bottom: 72px;
}

.updates-page {
  max-width: min(1040px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(20px, 4vw, 40px);
  padding-right: clamp(20px, 4vw, 40px);
  transition: max-width 0.22s ease, margin 0.22s ease, padding 0.22s ease;
}

/* Agent dock sits on the right — free that column and keep content left of it. */
body.gs-agent-open .updates-page {
  margin-left: 0;
  margin-right: auto;
  max-width: min(1040px, calc(100% - 460px));
  padding-right: 20px;
}

@media (max-width: 980px) {
  body.gs-agent-open .updates-page {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}

.updates-hero {
  padding: 36px 0 20px;
}

.updates-hero .gs-hero-title {
  font-size: clamp(2.2rem, 4.5vw, 3.1rem);
}

.updates-founder-post {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: stretch;
  margin: 0 0 26px;
  padding: 20px;
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 132, 36, 0.12), transparent 34%),
    radial-gradient(circle at 88% 82%, rgba(88, 166, 255, 0.12), transparent 36%),
    rgba(13, 17, 23, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
}

.updates-founder-copy {
  align-self: center;
}

.updates-founder-copy h3 {
  margin: 0 0 12px;
  font-family: var(--gs-display);
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  line-height: 1.05;
}

.updates-founder-copy p:not(.gs-kicker) {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.65;
}

.updates-social-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.updates-social-images img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 128px;
  object-fit: cover;
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 16px;
  background: #010409;
}

.updates-social-images img:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}

.updates-education-section {
  margin: 0 0 26px;
  padding: 20px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 0%, rgba(88, 166, 255, 0.16), transparent 38%),
    linear-gradient(135deg, rgba(13, 17, 23, 0.9), rgba(22, 27, 34, 0.62));
}

.updates-education-head {
  max-width: 760px;
}

.updates-education-head h3 {
  margin: 0 0 8px;
  font-family: var(--gs-display);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -0.04em;
}

.updates-education-head p:not(.gs-kicker) {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.updates-education-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.updates-education-grid article {
  padding: 14px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 16px;
  background: rgba(1, 4, 9, 0.32);
}

.updates-education-grid strong,
.updates-education-grid span {
  display: block;
}

.updates-education-grid strong {
  margin-bottom: 6px;
  color: #e6edf3;
}

.updates-education-grid span {
  color: #9da7b3;
  font-size: 0.86rem;
  line-height: 1.5;
}

.updates-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.75);
}

.updates-filter {
  appearance: none;
  border: 1px solid rgba(139, 148, 158, 0.24);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  color: #a9b4c0;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.updates-filter:hover {
  transform: translateY(-1px);
  color: #e6edf3;
  border-color: rgba(88, 166, 255, 0.48);
}

.updates-filter.is-active {
  color: #e6edf3;
  border-color: rgba(88, 166, 255, 0.72);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.24), rgba(46, 160, 67, 0.08));
}

.updates-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.updates-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap: 22px;
  align-items: center;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.65);
}

.updates-visual {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(88, 166, 255, 0.16);
  background: #010409;
}

.updates-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.updates-visual--empty {
  background:
    linear-gradient(145deg, #161b22, #0d1117),
    repeating-linear-gradient(90deg, transparent, transparent 22px, rgba(88, 166, 255, 0.05) 22px, rgba(88, 166, 255, 0.05) 23px);
}

.updates-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 8px;
}

.updates-kind {
  font-family: var(--gs-display, var(--font));
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #79b8ff;
}

.updates-meta time {
  font-size: 0.8rem;
  color: #6e7681;
}

.updates-copy h3 {
  margin: 0 0 8px;
  font-family: var(--gs-display, var(--font));
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  border: 0;
  padding: 0;
}

.updates-copy p {
  margin: 0 0 14px;
  color: #9da7b3;
  line-height: 1.55;
}

.updates-more {
  font-size: 0.88rem;
  font-weight: 600;
  color: #58a6ff;
  text-decoration: none;
}

.updates-more:hover {
  text-decoration: underline;
}

.updates-empty {
  padding: 24px 0;
}

.marketplace-seller-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(88, 166, 255, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.1), transparent 38%),
    rgba(7, 12, 20, 0.72);
}

.marketplace-seller-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.marketplace-seller-status.is-ready {
  color: #7ee787;
}

.seller-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.marketplace-payout-btn {
  appearance: none;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.86);
  color: #e6edf3;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.marketplace-payout-btn:hover,
.marketplace-payout-btn:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(88, 166, 255, 0.58);
}

.marketplace-payout-card {
  width: 100%;
  min-height: 72px;
  justify-content: flex-start;
  border-radius: 18px;
  padding: 12px 13px;
}

.marketplace-payout-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.marketplace-payout-state {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid rgba(139, 148, 158, 0.32);
  border-radius: 999px;
  color: #c9d1d9;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.68rem;
  font-weight: 850;
}

.marketplace-payout-state.is-connected {
  border-color: rgba(63, 185, 80, 0.48);
  color: #7ee787;
  background: rgba(63, 185, 80, 0.12);
}

.marketplace-payout-btn strong,
.marketplace-payout-btn small {
  display: block;
}

.marketplace-payout-btn strong {
  font-size: 0.82rem;
  line-height: 1.1;
}

.marketplace-payout-btn small {
  margin-top: 2px;
  color: #8b949e;
  font-size: 0.66rem;
  line-height: 1.1;
}

.marketplace-payout-btn--stripe {
  border-color: rgba(99, 91, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(99, 91, 255, 0.22), rgba(13, 17, 23, 0.9));
}

.marketplace-payout-btn--paypal {
  border-color: rgba(0, 112, 186, 0.42);
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 156, 222, 0.18), transparent 48%),
    rgba(13, 17, 23, 0.86);
}

.marketplace-payout-btn--phantom {
  border-color: rgba(171, 143, 255, 0.5);
  background:
    radial-gradient(circle at 0% 0%, rgba(171, 143, 255, 0.22), transparent 48%),
    rgba(13, 17, 23, 0.86);
}

.marketplace-payout-btn--cash {
  border-radius: 12px;
  border-color: rgba(0, 214, 75, 0.42);
}

.marketplace-payout-btn--venmo {
  border-radius: 12px;
  border-color: rgba(0, 136, 204, 0.42);
}

.marketplace-payout-btn--apple {
  border-color: rgba(255, 255, 255, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(13, 17, 23, 0.92));
}

.marketplace-payout-logo {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}

.marketplace-payout-logo--stripe {
  background: #635bff;
  color: #fff;
  font-size: 0.88rem;
  font-style: italic;
}

.marketplace-payout-logo--paypal {
  min-width: 66px;
  grid-auto-flow: column;
  gap: 0;
  background: #fff;
  font-size: 0.86rem;
}

.marketplace-payout-logo--paypal b:first-child {
  color: #003087;
}

.marketplace-payout-logo--paypal b:last-child {
  color: #009cde;
}

.marketplace-payout-logo--phantom {
  min-width: 34px;
  background: linear-gradient(135deg, #ab8fff, #5f49d8);
  color: #fff;
  font-size: 1.25rem;
}

.marketplace-payout-logo--cash {
  min-width: 34px;
  background: #00d64b;
  color: #06140a;
  font-size: 1.1rem;
}

.marketplace-payout-logo--venmo {
  min-width: 34px;
  background: #008cff;
  color: #fff;
  font-size: 1rem;
}

.marketplace-payout-logo--apple {
  min-width: 74px;
  background: #050505;
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: -0.02em;
}

.marketplace-paypal-connect,
.marketplace-alt-payout-row {
  display: inline-flex;
  align-items: stretch;
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(139, 148, 158, 0.2);
  border-radius: 16px;
  background: rgba(1, 4, 9, 0.36);
}

.marketplace-connect-modal {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 20%, rgba(0, 156, 222, 0.14), transparent 42%),
    rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(10px);
}

.marketplace-connect-card {
  position: relative;
  width: min(460px, 94vw);
  padding: 20px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.marketplace-connect-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 10px;
  background: rgba(1, 4, 9, 0.38);
  color: var(--text);
  cursor: pointer;
}

.marketplace-connect-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 38px 12px 0;
}

.marketplace-connect-brand h3 {
  margin: 2px 0 0;
}

.marketplace-connect-field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.marketplace-connect-field input {
  width: 100%;
  border: 1px solid rgba(139, 148, 158, 0.3);
  border-radius: 12px;
  background: #0d1117;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

.marketplace-connect-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.authorized-apps-list {
  display: grid;
  gap: 8px;
}

.authorized-app-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(139, 148, 158, 0.18);
  border-radius: 14px;
  background: rgba(1, 4, 9, 0.24);
}

.authorized-app-icon {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: 9px;
  background: rgba(88, 166, 255, 0.14);
  color: #e6edf3;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.authorized-app-row--stripe .authorized-app-icon {
  background: #635bff;
}

.authorized-app-row--paypal .authorized-app-icon {
  background: #fff;
  color: #003087;
}

.authorized-app-row--phantom .authorized-app-icon {
  background: linear-gradient(135deg, #ab8fff, #5f49d8);
}

.authorized-app-row--discord .authorized-app-icon {
  min-width: 34px;
  background: #5865f2;
  color: #fff;
  letter-spacing: 0;
}

.authorized-app-row--google-drive .authorized-app-icon {
  min-width: 34px;
  background: #fff;
  color: #1f2328;
}

.authorized-app-google-drive-mark {
  position: relative;
  width: 21px;
  height: 18px;
  display: inline-block;
}

.authorized-app-google-drive-mark i,
.authorized-app-google-drive-mark b,
.authorized-app-google-drive-mark em {
  position: absolute;
  display: block;
  width: 15px;
  height: 6px;
  border-radius: 2px;
  transform-origin: center;
}

.authorized-app-google-drive-mark i {
  left: 1px;
  top: 6px;
  background: #34a853;
  transform: rotate(120deg);
}

.authorized-app-google-drive-mark b {
  right: 1px;
  top: 6px;
  background: #fbbc04;
  transform: rotate(60deg);
}

.authorized-app-google-drive-mark em {
  left: 3px;
  bottom: 0;
  background: #4285f4;
}

.profile-backup-storage-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(88, 166, 255, 0.24);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(66, 133, 244, 0.14), transparent 42%),
    rgba(255, 255, 255, 0.025);
}

.profile-backup-storage-card span:last-child {
  display: grid;
  gap: 3px;
}

.profile-backup-storage-card small {
  color: var(--muted);
  line-height: 1.35;
}

.profile-backup-storage-orb {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 12px;
  background:
    conic-gradient(from 20deg, #4285f4, #34a853, #fbbc04, #ea4335, #4285f4);
  box-shadow: 0 0 20px rgba(66, 133, 244, 0.22);
}

.authorized-app-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.authorized-app-copy small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.authorized-app-state {
  padding: 3px 8px;
  border: 1px solid rgba(139, 148, 158, 0.25);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

.authorized-app-state.is-connected {
  border-color: rgba(63, 185, 80, 0.45);
  color: #7ee787;
  background: rgba(63, 185, 80, 0.1);
}

.marketplace-paypal-field,
.marketplace-alt-payout-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.marketplace-paypal-field input,
.marketplace-alt-payout-field input {
  min-width: 190px;
  border: 1px solid rgba(139, 148, 158, 0.28);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.92);
  color: var(--text);
  padding: 8px 10px;
}

@media (max-width: 700px) {
  .seller-actions,
  .marketplace-paypal-connect,
  .marketplace-alt-payout-row {
    align-items: stretch;
    flex-direction: column;
  }

  .marketplace-payout-btn,
  .marketplace-paypal-field,
  .marketplace-alt-payout-field {
    width: 100%;
    box-sizing: border-box;
  }

  .marketplace-paypal-field input,
  .marketplace-alt-payout-field input {
    min-width: 0;
    width: 100%;
  }

  .authorized-app-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .authorized-app-state,
  .authorized-app-row .btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .updates-founder-post {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .updates-social-images {
    grid-template-columns: 1fr;
  }

  .updates-education-grid {
    grid-template-columns: 1fr;
  }

  .updates-card {
    grid-template-columns: 1fr;
  }
}
/* Fusion-style Insert + McMaster-Carr browser */
.insert-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 18px 18px;
  background: rgba(1, 4, 9, 0.45);
}
.insert-panel-overlay.hidden { display: none; }
.insert-panel {
  width: min(520px, 94vw);
  background: var(--panel, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  padding: 16px;
  display: grid;
  gap: 12px;
}
.insert-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.insert-panel-head > div { display: flex; flex-direction: column; gap: 3px; }
.insert-panel-close {
  border: 0;
  background: transparent;
  color: var(--muted, #8b949e);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.insert-panel-grid { display: grid; gap: 10px; }
.insert-source-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border, #30363d);
  border-radius: 10px;
  background: #0d1117;
  color: inherit;
  cursor: pointer;
}
.insert-source-card:hover {
  border-color: #1f6feb;
  background: #0f1b2a;
}
.insert-source-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(160deg, #f85149, #da3633);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.insert-source-icon--logo {
  width: 118px;
  height: 48px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid #30363d;
}
.insert-source-icon--logo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 22px;
  object-fit: contain;
}
.insert-source-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.insert-source-copy strong { color: #e6edf3; font-size: 0.9rem; }
.insert-source-copy small,
.insert-panel-hint {
  color: var(--muted, #8b949e);
  font-size: 0.72rem;
  line-height: 1.4;
}
.mcmaster-insert-modal {
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background: rgba(1, 4, 9, 0.62);
}
.mcmaster-insert-modal.hidden { display: none; }
.mcmaster-insert-shell {
  width: min(1180px, 96vw);
  height: min(820px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #21262d;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  color: #c9d1d9;
}
.mcmaster-insert-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}
.mcmaster-insert-chrome-left,
.mcmaster-insert-chrome-right,
.mcmaster-insert-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mcmaster-insert-chrome-left strong {
  color: #e6edf3;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  white-space: nowrap;
}
.mcmaster-insert-min {
  width: 28px;
  height: 22px;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: #21262d;
  color: #8b949e;
  cursor: pointer;
  line-height: 1;
}
.mcmaster-insert-search {
  width: min(280px, 36vw);
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0d1117;
  color: #e6edf3;
  padding: 5px 8px;
  font-size: 0.78rem;
}
.mcmaster-insert-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
}
.mcmaster-insert-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.mcmaster-insert-frame.is-blocked {
  opacity: 0.18;
  pointer-events: none;
}
.mcmaster-insert-fallback {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 2;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(210, 153, 34, 0.35);
  background: rgba(22, 27, 34, 0.94);
  color: #e6edf3;
  pointer-events: none;
}
.mcmaster-insert-fallback p { margin: 0 0 4px; font-size: 0.8rem; }
.mcmaster-insert-drop {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px dashed rgba(88, 166, 255, 0.55);
  border-radius: 10px;
  background: rgba(13, 17, 23, 0.92);
  color: #e6edf3;
  pointer-events: auto;
}
.mcmaster-insert-drop.is-dragover {
  border-color: #3fb950;
  background: rgba(35, 134, 54, 0.2);
}
.mcmaster-insert-drop strong { font-size: 0.82rem; }
.mcmaster-insert-drop span { color: #8b949e; font-size: 0.72rem; }
.mcmaster-insert-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #161b22;
  border-top: 1px solid #30363d;
  flex-shrink: 0;
}
body.mcmaster-insert-open { overflow: hidden; }
@media (max-width: 720px) {
  .mcmaster-insert-chrome { flex-direction: column; align-items: stretch; }
  .mcmaster-insert-search { width: 100%; }
  .mcmaster-insert-footer { flex-direction: column; align-items: stretch; }
}

/* Simulated McMaster catalog (local — live site blocks iframes) */
.mcmaster-sim-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(210, 153, 34, 0.4);
  color: #d29922;
  background: rgba(210, 153, 34, 0.12);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mcmaster-sim-body {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 280px;
  flex: 1 1 auto;
  min-height: 0;
  background: #f4f1ea;
  color: #1b1f23;
}
.mcmaster-sim-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  background: #fff;
  border-right: 1px solid #d8d3c8;
  overflow: auto;
}
.mcmaster-sim-brand {
  margin: 0 4px 10px;
  padding: 4px 2px 10px;
  border-bottom: 2px solid #346734;
}
.mcmaster-sim-brand img {
  display: block;
  width: min(148px, 100%);
  height: auto;
  max-height: 24px;
  object-fit: contain;
  object-position: left center;
}
.mcmaster-sim-cat {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #333;
  text-align: left;
  padding: 7px 8px;
  font-size: 0.78rem;
  cursor: pointer;
}
.mcmaster-sim-cat:hover { background: #f0ebe1; }
.mcmaster-sim-cat.active {
  background: #c41230;
  color: #fff;
  font-weight: 700;
}
.mcmaster-sim-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #d8d3c8;
}
.mcmaster-sim-results-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px 8px;
  background: #fff;
  border-bottom: 1px solid #e6e1d6;
}
.mcmaster-sim-results-head strong {
  color: #1b1f23;
  font-size: 0.92rem;
}
.mcmaster-sim-results {
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.mcmaster-sim-empty { padding: 18px 8px; }
.mcmaster-sim-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 10px;
  border: 1px solid #ddd6c8;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  cursor: pointer;
}
.mcmaster-sim-card:hover { border-color: #c41230; }
.mcmaster-sim-card.active {
  border-color: #c41230;
  box-shadow: 0 0 0 2px rgba(196, 18, 48, 0.15);
}
.mcmaster-sim-card-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mcmaster-sim-card-copy em {
  color: #c41230;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
}
.mcmaster-sim-card-copy strong {
  color: #1b1f23;
  font-size: 0.8rem;
  line-height: 1.25;
}
.mcmaster-sim-card-copy small {
  color: #666;
  font-size: 0.7rem;
}
.mcmaster-sim-card-preview,
.mcmaster-sim-preview {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, #d0d5db 0%, #8b949e 45%, #4d5560 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
  position: relative;
  overflow: hidden;
}
.mcmaster-sim-preview {
  width: 100%;
  height: 140px;
  margin-bottom: 10px;
}
.mcmaster-sim-card-preview::after,
.mcmaster-sim-preview::after {
  content: "";
  position: absolute;
  inset: 18% 30%;
  border-radius: 4px;
  background: linear-gradient(180deg, #f0f3f6, #6e7681);
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}
.mcmaster-sim-card-preview[data-shape="plate"]::after,
.mcmaster-sim-preview[data-shape="plate"]::after {
  inset: 28% 12%;
  border-radius: 2px;
}
.mcmaster-sim-card-preview[data-shape="washer"]::after,
.mcmaster-sim-card-preview[data-shape="bearing"]::after,
.mcmaster-sim-card-preview[data-shape="spring"]::after,
.mcmaster-sim-preview[data-shape="washer"]::after,
.mcmaster-sim-preview[data-shape="bearing"]::after,
.mcmaster-sim-preview[data-shape="spring"]::after {
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at center, #f6f8fa 0 28%, #6e7681 30% 100%);
}
.mcmaster-sim-detail {
  overflow: auto;
  padding: 12px;
  background: #fff;
}
.mcmaster-sim-detail-card h3 {
  margin: 4px 0 6px;
  color: #1b1f23;
  font-size: 0.95rem;
  line-height: 1.3;
}
.mcmaster-sim-detail-card p {
  margin: 0 0 10px;
  color: #555;
  font-size: 0.78rem;
}
.mcmaster-sim-pn {
  color: #c41230;
  font-weight: 800;
  font-size: 0.78rem;
}
.mcmaster-sim-specs {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
}
.mcmaster-sim-specs > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  font-size: 0.74rem;
}
.mcmaster-sim-specs dt { color: #777; margin: 0; }
.mcmaster-sim-specs dd { margin: 0; color: #222; font-weight: 600; }
.mcmaster-sim-detail-card .btn.accent {
  width: 100%;
  justify-content: center;
}
.mcmaster-sim-real-link {
  display: inline-block;
  margin-top: 10px;
  color: #0969da;
  font-size: 0.72rem;
  text-decoration: none;
}
.mcmaster-sim-real-link:hover { text-decoration: underline; }
@media (max-width: 960px) {
  .mcmaster-sim-body {
    grid-template-columns: 140px minmax(0, 1fr);
  }
  .mcmaster-sim-detail {
    grid-column: 1 / -1;
    border-top: 1px solid #d8d3c8;
    max-height: 240px;
  }
}
@media (max-width: 640px) {
  .mcmaster-sim-body { grid-template-columns: 1fr; }
  .mcmaster-sim-nav { max-height: 140px; }
}

/* Live McMaster connected-window dock (Fusion-style, not iframe) */
.mcmaster-live-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #484f58;
  color: #8b949e;
  background: rgba(110, 118, 129, 0.12);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mcmaster-live-badge.is-live {
  border-color: rgba(63, 185, 80, 0.45);
  color: #3fb950;
  background: rgba(63, 185, 80, 0.12);
}
.mcmaster-insert-shell--live {
  width: min(1100px, 96vw);
  height: min(780px, 92vh);
}
.mcmaster-live-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  background: #0d1117;
}
.mcmaster-live-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow: auto;
  border-right: 1px solid #30363d;
  background: #161b22;
}
.mcmaster-live-dock-brand img {
  display: block;
  max-width: 170px;
  height: auto;
  max-height: 28px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
}
.mcmaster-live-explain {
  margin: 0;
  color: #c9d1d9;
  font-size: 0.78rem;
  line-height: 1.45;
}
.mcmaster-live-explain code {
  font-size: 0.72rem;
  color: #79c0ff;
}
.mcmaster-live-drop {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 14px;
  border: 1px dashed rgba(88, 166, 255, 0.5);
  border-radius: 12px;
  background: rgba(56, 139, 253, 0.08);
}
.mcmaster-live-drop.is-dragover,
.mcmaster-live-drop.is-attention {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.14);
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18);
}
.mcmaster-live-drop strong { color: #e6edf3; font-size: 0.88rem; }
.mcmaster-live-drop span { color: #8b949e; font-size: 0.72rem; }
.mcmaster-live-shortcuts { display: grid; gap: 6px; }
.mcmaster-live-shortcut-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mcmaster-quick-block,
.mcmaster-library-block {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #30363d;
}
.mcmaster-quick-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mcmaster-quick-head strong { color: #e6edf3; font-size: 0.8rem; }
.mcmaster-quick-list {
  display: grid;
  gap: 6px;
}
.mcmaster-quick-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 8px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: inherit;
  cursor: pointer;
}
.mcmaster-quick-card:hover { border-color: #58a6ff; }
.mcmaster-quick-card em {
  display: block;
  color: #79c0ff;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
}
.mcmaster-quick-card strong {
  display: block;
  color: #e6edf3;
  font-size: 0.76rem;
}
.mcmaster-quick-card small {
  display: block;
  color: #8b949e;
  font-size: 0.68rem;
}
.mcmaster-library-list { display: grid; gap: 6px; }
.mcmaster-library-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}
.mcmaster-library-row strong {
  color: #e6edf3;
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mcmaster-library-row small { color: #8b949e; font-size: 0.66rem; flex-shrink: 0; }
.mcmaster-live-stage {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(88, 166, 255, 0.12), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(63, 185, 80, 0.08), transparent 45%),
    #0d1117;
}
.mcmaster-live-stage-card {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid #30363d;
  border-radius: 14px;
  background: rgba(22, 27, 34, 0.92);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.mcmaster-live-stage-visual {
  height: 120px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, #21262d, #161b22 40%, #0d1117),
    repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(88, 166, 255, 0.05) 8px, rgba(88, 166, 255, 0.05) 16px);
  border: 1px solid #30363d;
  position: relative;
}
.mcmaster-live-stage-visual::after {
  content: "LIVE WINDOW";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #58a6ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.mcmaster-insert-modal.is-connected .mcmaster-live-stage-visual::after {
  content: "CONNECTED";
  color: #3fb950;
}
.mcmaster-live-stage-card h3 {
  margin: 0;
  color: #e6edf3;
  font-size: 1.05rem;
}
.mcmaster-live-stage-card p {
  margin: 0;
  color: #8b949e;
  font-size: 0.82rem;
  line-height: 1.45;
}
.mcmaster-live-stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mcmaster-live-steps {
  margin: 4px 0 0;
  padding-left: 18px;
  color: #c9d1d9;
  font-size: 0.78rem;
  line-height: 1.5;
}
@media (max-width: 860px) {
  .mcmaster-live-layout { grid-template-columns: 1fr; }
  .mcmaster-live-stage { min-height: 240px; }
}

/* Insert panel — clean + recent */
.insert-panel--clean {
  width: min(440px, 94vw);
  gap: 14px;
}
.insert-panel-actions {
  display: flex;
  gap: 8px;
  padding-top: 2px;
  border-top: 1px solid #30363d;
}
.insert-recent-block {
  display: grid;
  gap: 8px;
}
.insert-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.insert-recent-head strong {
  color: #e6edf3;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.insert-recent-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}
.insert-recent-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 2px;
}
.insert-recent-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 8px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: inherit;
  cursor: pointer;
}
.insert-recent-card:hover { border-color: #58a6ff; }
.insert-recent-card strong {
  display: block;
  color: #e6edf3;
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insert-recent-card small {
  display: block;
  color: #8b949e;
  font-size: 0.66rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* McMaster dock as viewport tab (same overlay plane as DXF/ref) */
.mcmaster-viewer {
  display: flex;
  flex-direction: column;
  background: #0d1117;
  z-index: 5;
}
.mcmaster-viewer.hidden { display: none !important; }
.mcmaster-tab-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.mcmaster-tab-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #30363d;
  background: #161b22;
}
.mcmaster-tab-chrome-left,
.mcmaster-tab-chrome-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.mcmaster-tab-logo {
  display: block;
  height: 18px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  padding: 4px 8px;
}
.mcmaster-tab-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 0;
}
.mcmaster-tab-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow: auto;
  border-right: 1px solid #30363d;
}
.mcmaster-tab-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow: auto;
  background: #161b22;
}
.mcmaster-tab-hint { margin: 0; line-height: 1.45; }
.mcmaster-tab-main .mcmaster-live-drop {
  min-height: 140px;
  place-content: center;
}
@media (max-width: 860px) {
  .mcmaster-tab-body { grid-template-columns: 1fr; }
  .mcmaster-tab-main { border-right: 0; border-bottom: 1px solid #30363d; }
  .insert-recent-list { grid-template-columns: 1fr; }
}

/* McMaster tab — stage downloads then insert; recent on right */
.mcmaster-stage-banner {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: rgba(88, 166, 255, 0.08);
}
.mcmaster-stage-banner strong { color: #e6edf3; font-size: 0.82rem; }
.mcmaster-stage-banner span { color: #8b949e; font-size: 0.72rem; }
.mcmaster-drop-actions { display: flex; gap: 8px; margin-top: 4px; }
.mcmaster-viewer.is-awaiting .mcmaster-live-drop {
  border-color: #3fb950;
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18);
}
.mcmaster-pending-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #161b22;
}
.mcmaster-pending-list { display: grid; gap: 8px; }
.mcmaster-pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}
.mcmaster-pending-copy { min-width: 0; }
.mcmaster-pending-copy strong {
  display: block;
  color: #e6edf3;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mcmaster-pending-copy small { color: #8b949e; font-size: 0.68rem; }
.mcmaster-pending-row-actions,
.mcmaster-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mcmaster-recent-side {
  display: grid;
  gap: 8px;
}
.mcmaster-recent-side-list {
  display: grid;
  gap: 8px;
  max-height: min(48vh, 420px);
  overflow: auto;
}
.mcmaster-recent-side-list .insert-recent-card {
  grid-template-columns: 36px minmax(0, 1fr);
}

.mcmaster-local-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #161b22;
}
.mcmaster-local-list { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.mcmaster-local-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}
.insert-recent-card--simple {
  grid-template-columns: 1fr;
  padding: 8px 10px;
}
.insert-recent-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mcmaster-quick-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}


.mcmaster-pending-actions[hidden],
.mcmaster-pending-actions.is-empty {
  display: none !important;
}
.mcmaster-local-block.is-attention {
  border-color: #3fb950;
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18);
}

.mcmaster-ref-link-field {
  display: grid;
  gap: 4px;
}
.mcmaster-ref-link-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: #e6edf3;
  font-size: 0.78rem;
}
.mcmaster-ref-link-input:focus {
  outline: none;
  border-color: #58a6ff;
}

.mcmaster-got-download-banner {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 10px;
  background: rgba(56, 139, 253, 0.1);
}
.mcmaster-got-download-banner.is-urgent {
  border-color: #3fb950;
  background: rgba(63, 185, 80, 0.14);
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18);
}
.mcmaster-got-download-banner strong { color: #e6edf3; font-size: 0.86rem; }
.mcmaster-got-download-banner span { color: #c9d1d9; font-size: 0.74rem; line-height: 1.4; }
.mcmaster-got-download-banner .btn { justify-self: start; }

.mcmaster-bucket-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.55);
}

.mcmaster-download-path-hint { margin: 0; line-height: 1.4; }
.mcmaster-local-status.is-linked,
[data-mcmaster-local-status].is-linked {
  color: #3fb950 !important;
  font-weight: 700;
}
.mcmaster-chrome-hint {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px dashed #484f58;
  border-radius: 8px;
  background: rgba(110, 118, 129, 0.08);
}
.mcmaster-chrome-hint[hidden] { display: none !important; }
.mcmaster-chrome-hint strong { color: #e6edf3; font-size: 0.78rem; }
.mcmaster-chrome-hint ol {
  margin: 0;
  padding-left: 18px;
  color: #c9d1d9;
  font-size: 0.72rem;
  line-height: 1.45;
}
.mcmaster-chrome-hint code {
  color: #79c0ff;
  font-size: 0.7rem;
}

.mcmaster-auto-upload {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: rgba(63, 185, 80, 0.08);
  color: #c9d1d9;
  font-size: 0.74rem;
  line-height: 1.4;
  cursor: pointer;
}
.mcmaster-auto-upload input { margin-top: 2px; }
.mcmaster-auto-upload strong { color: #e6edf3; }
