:root {
  color-scheme: dark;
  --vb-theme-name: Electric Glass;
  --vb-black: #010101;
  --vb-white: #F0F0F0;
  --vb-lime: #F0F0F0;
  --vb-purple: #7E3BED;
  --bg: var(--vb-black);
  --surface: #09090b;
  --surface-2: #111114;
  --accent: var(--vb-lime);
  --accent-dim: rgba(240, 240, 240, .13);
  --accent-soft: rgba(240, 240, 240, .08);
  --accent-ring: rgba(240, 240, 240, .3);
  --ai: var(--vb-purple);
  --ai-dim: rgba(126, 59, 237, .16);
  --ai-ring: rgba(126, 59, 237, .34);
  --border: rgba(240, 240, 240, .1);
  --panel: var(--surface);
  --panel-2: var(--surface-2);
  --panel-3: #19191d;
  --line: rgba(240, 240, 240, .16);
  --line-soft: var(--border);
  --blue: var(--ai);
  --amber: #F0F0F0;
  --muted: #d7d7df;
  --subtle: var(--text-2);
  --dim: var(--text-3);
  /* Text hierarchy */
  --text: var(--vb-white);
  --text-2: #c8c8d0;
  --text-3: #848490;
  /* Functional (minimal use) */
  --green: var(--vb-lime);
  --red: #ef4444;
  --radius: 6px;
  --mono: "Cascadia Code", "Fira Code", Consolas, monospace;
  --sans: "Segoe UI", "Noto Sans SC", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
  --sidebar-width: 240px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* App Layout with Sidebar */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease, margin-left 0.2s ease;
}

.sidebar.collapsed {
  width: 0;
  margin-left: -1px;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .brand {
  gap: 8px;
}

.brand-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-header .ghost-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.conv-item {
  position: relative;
  padding: 10px 32px 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s ease;
  border: 1px solid transparent;
}

.conv-item:hover {
  background: var(--surface-2);
}

.conv-item.active {
  background: var(--accent-dim);
  border-color: var(--accent-ring);
}

.conv-item.pending {
  opacity: .72;
}

.conv-item .conv-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item .conv-time {
  font-size: 11px;
  color: var(--text-3);
}

/* Delete button - hidden by default, show on hover */
.conv-delete {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.conv-item:hover .conv-delete {
  opacity: 1;
}

.conv-delete:hover {
  background: rgba(239, 68, 68, .15);
  color: var(--red);
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
}

.market-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  transition: all 0.12s ease;
}

.sidebar-action {
  margin-bottom: 8px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.market-link:hover {
  background: var(--accent-dim);
  border-color: var(--accent-ring);
}

.market-link-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
}

.market-link-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.9;
}

.market-link-label {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}

.shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg);
}

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#sidebarToggle {
  width: 32px;
  font-size: 16px;
}

.brand,
.top-actions,
.device-toolbar,
.panel-head,
.board-title {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 34px;
  height: 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.mark span {
  border-radius: 2px;
  background: var(--green);
}

.mark span:nth-child(2) {
  background: var(--accent);
}

.mark span:nth-child(3) {
  background: var(--text-2);
}

.brand p,
.kicker {
  margin: 0;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: var(--mono);
  font-size: 18px;
}

h2 {
  font-size: 16px;
}

.top-actions {
  gap: 8px;
}

.account-menu-wrap {
  position: relative;
}

.account-menu-trigger {
  min-width: 72px;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 230px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .26);
}

.account-menu-head {
  display: grid;
  gap: 4px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.account-menu-head span {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
}

.account-menu-head strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-item {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.account-menu-item:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
}

.guide-panel {
  width: min(860px, calc(100vw - 32px));
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.guide-grid section {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .03);
}

.guide-grid h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text);
}

.guide-grid p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

.credit-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-link {
  min-height: 32px;
  padding: 0 10px;
  text-decoration: none;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.prompt-row button,
.tabs button {
  min-height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.primary-btn {
  padding: 0 14px;
  border-color: var(--accent-ring);
  background: var(--accent);
  color: var(--vb-black, #010101);
  font-weight: 700;
}

.primary-btn:disabled {
  opacity: .5;
  cursor: wait;
}

.primary-btn.wide {
  width: 100%;
  margin-top: 8px;
}

.ghost-btn,
.icon-btn,
.prompt-row button,
.tabs button {
  background: var(--surface-2);
  color: var(--text-2);
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-family: var(--mono);
  font-weight: 700;
}

.ghost-btn {
  padding: 0 12px;
}

.model-btn {
  max-width: 230px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.model-btn span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modelDot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 999px;
  background: var(--text-3);
}

#modelDot.online {
  background: var(--green);
  box-shadow: 0 0 8px rgba(34, 197, 94, .6);
}

.ghost-btn:hover,
.icon-btn:hover,
.prompt-row button:hover,
.tabs button:hover {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 35%) minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.agent-panel,
.hardware-panel,
.drawer {
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  overflow: hidden;
}

.hardware-panel {
  min-height: 0;
}

.agent-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

.panel-head {
  min-height: 48px;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-head.small {
  min-height: 44px;
}

.pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  background: rgba(255, 255, 255, .03);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.chat-log {
  min-height: 0;
  padding: 12px;
  overflow: auto;
}

.msg {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.msg.user {
  grid-template-columns: 1fr 30px;
}

.msg.user .avatar {
  grid-column: 2;
}

.msg.user p,
.msg.user .stage-card {
  grid-column: 1;
  grid-row: 1;
  background: var(--ai-soft, rgba(126, 59, 237, .1));
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
}

.msg p,
.stage-card {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.58;
}

.stage-card {
  display: grid;
  gap: 8px;
}

.stage-card strong {
  font-size: 13px;
}

.stage-list {
  display: grid;
  gap: 7px;
}

.stage {
  min-height: 32px;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
}

.stage i {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.stage span {
  color: var(--text-2);
  font-size: 12px;
}

.stage em {
  color: var(--text-3);
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
}

.stage.active {
  border-color: var(--ai-ring, rgba(126, 59, 237, .36));
}

.stage.active i {
  background: var(--ai, var(--accent));
  box-shadow: 0 0 8px var(--ai-ring, rgba(126, 59, 237, .36));
}

.stage.done {
  border-color: rgba(34, 197, 94, .3);
}

.stage.done i {
  background: var(--green);
}

.stage.fail {
  border-color: rgba(239, 68, 68, .3);
}

.stage.fail i {
  background: var(--red);
}

.work-log {
  display: grid;
  gap: 4px;
  max-height: 130px;
  overflow: auto;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(255, 255, 255, .03);
}

.work-log-item {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.prompt-row {
  padding: 0 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-row button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--accent);
  font-size: 12px;
}

.composer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.composer label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12px;
}

textarea {
  width: 100%;
  min-height: 100px;
  resize: none;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

textarea:focus {
  border-color: var(--accent);
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.asset-tools,
.agent-mode-select {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.asset-state {
  min-width: 0;
  max-width: 140px;
  overflow: hidden;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-mode-select {
  flex: none;
  color: var(--text-3);
  font-size: 11px;
}

.agent-mode-select select {
  min-height: 30px;
  max-width: 132px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-2);
  font-size: 12px;
}

.hardware-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr;
}

.board-strip {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(420px, 1.3fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.board-title {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.board-title h2 span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}

.board-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.board-facts div,
.runtime-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.board-facts span,
.runtime-grid span {
  display: block;
  color: var(--text-3);
  font-size: 11px;
}

.board-facts strong,
.runtime-grid strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-grid strong.ok {
  color: var(--green);
}

.runtime-grid strong.fail {
  color: var(--red);
}

.cap-list {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 4px;
}

.cap {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 10px;
}

.cap.ok {
  color: var(--green);
  border-color: rgba(34, 197, 94, .25);
  background: rgba(34, 197, 94, .06);
}

.cap.warn {
  color: #F0F0F0;
  border-color: rgba(240, 240, 240, .25);
  background: rgba(240, 240, 240, .06);
}

.device-area {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  padding: 12px;
}

.device-card {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.device-toolbar {
  min-height: 48px;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.device-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.device-select {
  min-width: 108px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 30px 0 10px;
  font-size: 12px;
  outline: none;
}

.device-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.device-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100%;
  padding: 10px;
  overflow: hidden;
}

/* Real photo Mac frame */
.mac-photo {
  position: relative;
  width: min(100%, calc((100vh - 132px) * 0.6667));
  max-width: 620px;
  max-height: calc(100vh - 132px);
  user-select: none;
}

.mac-photo-img {
  width: 100%;
  height: auto;
  display: block;
}

.mac-screen-overlay {
  position: absolute;
  /* Screen position in the Mac photo (1000x1500 image) */
  left: var(--screen-left, 30.18%);
  top: var(--screen-top, 31.88%);
  width: var(--screen-width, 44.3%);
  height: var(--screen-height, 21.8%);
  overflow: hidden;
  background: #000;
}

.mac-screen-overlay iframe {
  width: 480px;
  height: 360px;
  border: none;
  display: block;
  background: #000;
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--screen-scale, 1));
  transform-origin: center center;
  opacity: 1;
  transition: opacity .18s ease;
  will-change: opacity;
}

.preview-loading-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(4, 10, 18, .96), rgba(6, 15, 28, .98)),
    #050b14;
  color: rgba(226, 242, 255, .86);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}

.preview-loading-mask span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid var(--accent-ring);
  border-top-color: var(--accent);
  animation: preview-spin .8s linear infinite;
}

.preview-loading-mask strong {
  font-size: 12px;
  font-weight: 700;
}

.mac-photo.preview-loading .mac-screen-overlay iframe {
  opacity: 0;
}

.mac-photo.preview-loading .preview-loading-mask {
  opacity: 1;
}

.mac-photo.preview-ready .mac-screen-overlay iframe {
  opacity: 1;
}

@keyframes preview-spin {
  to {
    transform: rotate(360deg);
  }
}

.mac {
  width: min(640px, 100%);
  aspect-ratio: 1.22;
  position: relative;
  transform: translateX(24px);
  padding: 42px 48px 76px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 24px;
  background: linear-gradient(145deg, #d8d1c1, #9b9486);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.display-frame {
  width: 100%;
  height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  padding: 16px;
  box-sizing: border-box;
  border-radius: 12px;
  background: #111;
}

.screen-viewport {
  width: 480px;
  height: 360px;
  position: relative;
  overflow: hidden;
  background: #000;
}

.device-screen {
  width: 480px;
  height: 360px;
  aspect-ratio: 4 / 3;
  flex: none;
  position: relative;
  overflow: hidden;
  background: #000;
  transform: scale(var(--screen-scale, 1));
  transform-origin: 0 0;
}

.device-screen iframe {
  width: 480px;
  height: 360px;
  position: absolute;
  left: 0;
  top: 0;
  border: 0;
  background: #000;
}

.screen-app {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 12px;
  color: white;
  background:
    linear-gradient(145deg, rgba(34, 197, 94, .14), transparent 42%),
    linear-gradient(330deg, rgba(126, 59, 237, .16), transparent 45%),
    #10161e;
}

.screen-app header {
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.screen-app header span,
.hero-card span,
.hero-card small,
.screen-grid span {
  color: #cbd5e1;
  font-size: 12px;
}

.screen-app header strong {
  font-family: var(--mono);
  font-size: 38px;
  line-height: 1;
}

.hero-card,
.screen-grid div {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
}

.hero-card {
  padding: 11px;
}

.hero-card strong {
  display: block;
  margin: 4px 0;
  font-size: 24px;
  line-height: 1.12;
}

.hero-card small {
  display: block;
  line-height: 1.4;
}

.screen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.screen-grid div {
  min-width: 0;
  padding: 9px;
}

.screen-grid strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mac-slot {
  position: absolute;
  left: 50%;
  bottom: 40px;
  width: 58px;
  height: 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(0, 0, 0, .34);
}

.mac-foot {
  position: absolute;
  left: 50%;
  bottom: -36px;
  width: 126px;
  height: 50px;
  transform: translateX(-50%);
  border-radius: 0 0 18px 18px;
  background: linear-gradient(#9e9788, #746d61);
}

.runtime-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.runtime-grid {
  align-content: start;
  display: grid;
  gap: 6px;
  padding: 10px;
}

.verify-list {
  display: grid;
  gap: 4px;
  padding: 0 10px 10px;
  overflow: auto;
}

.verify-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
}

.verify-item b,
.verify-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.verify-item b {
  color: var(--text);
  font-size: 11px;
}

.verify-item small {
  margin-top: 2px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
}

.verify-item span {
  min-width: 42px;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
}

.verify-item.pass {
  border-color: rgba(34, 197, 94, .25);
}

.verify-item.pass span {
  color: var(--green);
}

.verify-item.fail {
  border-color: rgba(239, 68, 68, .3);
}

.verify-item.fail span {
  color: var(--red);
}

.deploy-log {
  min-height: 0;
  margin: 0 10px 10px;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--accent);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(720px, 100vw);
  display: grid;
  grid-template-rows: auto auto 1fr;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform .22s ease, opacity .18s ease, visibility 0s linear .22s;
  box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
}

.status-drawer {
  display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.job-drawer {
  width: min(520px, 100vw);
  grid-template-rows: auto auto minmax(0, 1fr);
}

.usage-drawer {
  width: min(560px, 100vw);
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.status-drawer .drawer-head h2 span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}

.status-drawer .board-facts,
.status-drawer .cap-list,
.status-drawer .runtime-grid,
.status-drawer .verify-list {
  padding: 10px;
}

.status-drawer .board-facts {
  grid-template-columns: 1fr 1fr;
}

.status-drawer .cap-list {
  justify-content: start;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.job-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.job-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.usage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.usage-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.usage-summary div,
.usage-row,
.usage-empty {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.usage-summary div {
  min-width: 0;
  padding: 10px;
}

.usage-summary span {
  display: block;
  color: var(--text-3);
  font-size: 11px;
}

.usage-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.usage-ledger {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.usage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
}

.usage-row strong {
  display: block;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
}

.usage-row span {
  color: var(--text-3);
}

.usage-empty {
  padding: 14px;
  color: var(--text-2);
  font-size: 13px;
}

.job-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.job-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.job-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0;
}

.job-meta,
.job-log {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
}

.job-log-details {
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 5px;
  background: rgba(0, 0, 0, .16);
}

.job-log-details summary {
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  user-select: none;
}

.job-log {
  display: grid;
  gap: 3px;
  padding: 0 8px 8px;
  border: 0;
  background: transparent;
}

.job-status {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
}

.job-status.queued,
.job-status.running {
  color: var(--accent);
  border-color: var(--accent-ring);
  background: var(--accent-soft);
}

.job-status.succeeded {
  color: var(--green);
  border-color: rgba(34, 197, 94, .28);
  background: rgba(34, 197, 94, .08);
}

.job-status.failed,
.job-status.canceled {
  color: var(--red);
  border-color: rgba(239, 68, 68, .28);
  background: rgba(239, 68, 68, .08);
}

.job-error {
  padding: 8px;
  border: 1px solid rgba(239, 68, 68, .22);
  border-radius: 5px;
  color: var(--text-2);
  background: rgba(239, 68, 68, .06);
  font-size: 12px;
  line-height: 1.5;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.job-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}

.job-actions button.primary {
  border-color: var(--accent-ring);
  background: var(--accent-dim);
  color: var(--accent);
}

.drawer.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.drawer-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tabs button {
  min-height: 32px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 11px;
}

.tabs button.active {
  color: var(--green);
  border-color: rgba(34, 197, 94, .3);
  background: rgba(34, 197, 94, .06);
}

pre {
  margin: 0;
  overflow: auto;
  padding: 12px;
  background: var(--bg);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, .45);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 18px;
}

.modal.open {
  display: grid;
}

.modal-panel {
  width: min(560px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.model-form {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.model-form label {
  display: grid;
  gap: 4px;
}

.model-form label span,
.model-help {
  color: var(--text-2);
  font-size: 12px;
}

.model-form input,
.model-form select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.model-form input:focus,
.model-form select:focus {
  border-color: var(--accent);
}

.model-help {
  padding: 8px;
  border: 1px solid var(--ai-ring);
  border-radius: var(--radius);
  background: var(--ai-soft);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.hidden {
  display: none !important;
}

.auth-modal {
  padding: 24px;
}

.auth-panel {
  position: relative;
  width: min(520px, calc(100vw - 48px));
  max-width: 520px;
  padding: 44px 52px 36px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #0b0d10;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .18);
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  font: 600 18px/1 var(--font);
  cursor: pointer;
}

.auth-close:hover,
.auth-close:focus-visible {
  background: #f4f4f4;
  outline: 2px solid #111;
  outline-offset: 2px;
}

.auth-heading {
  display: grid;
  gap: 8px;
  margin: 0 0 26px;
  text-align: center;
}

.auth-product {
  margin: 0;
  color: #111;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.auth-heading h2 {
  margin: 0;
  color: #050505;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0;
}

.auth-subtitle {
  margin: 0;
  color: #404040;
  font-size: 14px;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 24px;
  border: 1px solid #111;
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab + .auth-tab {
  border-left: 1px solid #111;
}

.auth-tab.active {
  color: #fff;
  background: #1f8f3a;
}

.auth-tab:focus-visible {
  position: relative;
  outline: 2px solid #111;
  outline-offset: 2px;
}

.auth-form {
  display: grid;
  gap: 20px;
  padding: 0;
}

.auth-field {
  display: grid;
  gap: 8px;
  margin: 0;
}

.auth-field span {
  color: #050505;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.auth-field input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid #111;
  border-radius: 0;
  outline: none;
  background: #fff;
  color: #050505;
  font: 400 16px/1.2 var(--font);
}

.auth-field input::placeholder {
  color: #7a7a7a;
}

.auth-field input:focus {
  border-color: #111;
  box-shadow: 0 0 0 2px #111;
}

.auth-form .primary-btn.wide {
  width: 100%;
  min-height: 56px;
  margin-top: 4px;
  border: 1px solid #1f8f3a;
  border-radius: 0;
  background: #1f8f3a;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: none;
}

.auth-form .primary-btn.wide:hover,
.auth-form .primary-btn.wide:focus-visible {
  background: #187b31;
  border-color: #187b31;
  outline: 2px solid #111;
  outline-offset: 2px;
}

.auth-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.auth-message {
  min-height: 20px;
  margin: 14px 0 0;
  padding: 0;
  color: #4a4a4a;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
}

@media (max-width: 560px) {
  .auth-modal {
    padding: 16px;
  }

  .auth-panel {
    width: min(100%, calc(100vw - 32px));
    padding: 40px 24px 28px;
  }

  .auth-heading h2 {
    font-size: 24px;
  }
}

.portal-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, .95), rgba(238, 245, 255, .92)),
    radial-gradient(circle at 50% 0%, rgba(40, 111, 255, .14), transparent 44%),
    #f7fbff;
  color: #0b1220;
}

.portal-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 0 44px;
}

.portal-header,
.portal-brand,
.portal-header-actions,
.portal-section-head,
.board-card-top {
  display: flex;
  align-items: center;
}

.portal-header {
  justify-content: center;
  gap: 18px;
  padding-bottom: 24px;
  position: relative;
}

.portal-brand {
  gap: 12px;
}

.portal-brand .mark {
  border-color: rgba(30, 89, 224, .32);
  background: #fff;
}

.portal-brand p {
  margin: 0;
  color: #526070;
  font-size: 12px;
  font-weight: 700;
}

.portal-brand h1 {
  margin: 2px 0 0;
  color: #0b1220;
  font-size: 24px;
  font-family: var(--sans);
  font-weight: 750;
}

.portal-header-actions {
  position: absolute;
  right: 0;
  top: 0;
  gap: 8px;
}

.portal-page .ghost-btn {
  border-color: rgba(30, 89, 224, .18);
  background: rgba(255, 255, 255, .82);
  color: #163a7a;
}

.portal-page .ghost-btn:hover {
  background: #fff;
  border-color: rgba(30, 89, 224, .38);
}

.portal-hero {
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 24px;
  padding: 20px 0 48px;
}

.portal-copy {
  width: min(720px, 100%);
  text-align: center;
}

.portal-copy .kicker {
  color: #1e59e0;
}

.portal-copy h2 {
  margin: 10px 0 10px;
  color: #08111f;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.08;
  font-weight: 780;
}

.portal-copy p {
  width: min(620px, 100%);
  margin: 0 auto;
  color: #4b5b70;
  font-size: 15px;
  line-height: 1.7;
}

.portal-auth-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(30, 89, 224, .18);
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 22px 60px rgba(23, 57, 121, .12);
  backdrop-filter: blur(16px);
}

.portal-auth-card .kicker,
.portal-section-head .kicker {
  color: #1e59e0;
}

.portal-auth-card h2,
.portal-section-head h2 {
  margin: 6px 0 24px;
  color: #08111f;
  font-size: 28px;
  font-weight: 750;
}

.portal-board-area {
  width: min(1040px, 100%);
  min-width: 0;
}

.portal-section-head {
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  gap: 8px;
  margin-bottom: 16px;
}

.portal-section-head h2 {
  margin-bottom: 0;
}

.portal-section-head p:last-child {
  margin: 0;
  color: #4b5b70;
  font-size: 13px;
}

.portal-section-head-row {
  flex-direction: row;
  align-items: flex-start;
  text-align: left;
  gap: 18px;
}

.portal-section-head-row p:last-child {
  max-width: 460px;
  line-height: 1.55;
}

.board-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.board-card {
  display: grid;
  gap: 14px;
  min-height: 260px;
  padding: 18px;
  border: 1px solid rgba(30, 89, 224, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 16px 44px rgba(23, 57, 121, .1);
}

.board-card-top {
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.board-family {
  display: block;
  margin-bottom: 8px;
  color: #526070;
  font-size: 12px;
  font-weight: 700;
}

.board-card h3 {
  margin: 0;
  color: #08111f;
  font-size: 18px;
  line-height: 1.25;
}

.board-card p {
  margin: 0;
  color: #4b5b70;
  font-size: 13px;
  line-height: 1.55;
}

.board-status {
  flex: none;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(30, 89, 224, .18);
  color: #163a7a;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}

.board-status.available {
  background: #1e59e0;
  color: #fff;
  border-color: #1e59e0;
}

.board-status.experimental {
  background: #eef4ff;
}

.board-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.board-tags span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(30, 89, 224, .16);
  border-radius: 999px;
  color: #163a7a;
  background: #f4f8ff;
  font-size: 12px;
}

.board-enter {
  align-self: end;
  width: 100%;
  min-height: 44px;
  border: 1px solid #1e59e0;
  border-radius: 10px;
  background: #1e59e0;
  color: #fff;
}

.portal-device-section {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid rgba(30, 89, 224, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 16px 44px rgba(23, 57, 121, .08);
}

.portal-device-section .portal-section-head h2 {
  font-size: 22px;
}

.device-bind-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin: 8px 0 0;
}

.device-bind-submit {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #1e59e0;
  border-radius: 10px;
  background: #1e59e0;
  color: #fff;
}

.device-bind-submit:disabled {
  opacity: .62;
  cursor: wait;
}

.device-bind-message {
  min-height: 18px;
  margin-top: 10px;
}

.my-device-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.my-device-card,
.my-device-empty {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
}

.my-device-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.my-device-empty {
  padding: 16px;
}

.my-device-empty h3,
.my-device-empty p,
.my-device-card h3,
.my-device-card p {
  margin: 0;
}

.my-device-empty h3,
.my-device-card h3 {
  color: #08111f;
  font-size: 15px;
  font-weight: 750;
}

.my-device-empty p,
.my-device-card p {
  color: #526070;
  font-size: 13px;
  line-height: 1.5;
}

.device-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, .12);
  background: linear-gradient(145deg, #eef2f8, #c9d2df);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.device-avatar.white {
  background: linear-gradient(145deg, #fff, #e8edf4);
}

.device-avatar.gray {
  background: linear-gradient(145deg, #dce2eb, #8e9aaa);
}

.device-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.device-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.device-title-row h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-status {
  flex: none;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eaf7ef;
  color: #14783a;
  font-size: 12px;
  font-weight: 700;
}

.device-serial {
  width: max-content;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f4f7fb;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.device-open {
  min-height: 38px;
  white-space: nowrap;
}

.portal-page .auth-tabs {
  border-color: rgba(30, 89, 224, .24);
  border-radius: 10px;
  overflow: hidden;
}

.portal-page .auth-tab {
  color: #163a7a;
}

.portal-page .auth-tab + .auth-tab {
  border-left-color: rgba(30, 89, 224, .24);
}

.portal-page .auth-tab.active {
  background: #1e59e0;
  color: #fff;
}

.portal-page .auth-field span {
  color: #132033;
}

.portal-page .auth-field input {
  border-color: rgba(30, 89, 224, .22);
  border-radius: 10px;
  color: #08111f;
}

.portal-page .auth-field input:focus {
  border-color: #1e59e0;
  box-shadow: 0 0 0 3px rgba(30, 89, 224, .14);
}

.portal-page .auth-form .primary-btn.wide {
  border-color: #1e59e0;
  border-radius: 10px;
  background: #1e59e0;
  color: #fff;
}

.portal-page .auth-form .primary-btn.wide:hover,
.portal-page .auth-form .primary-btn.wide:focus-visible {
  background: #1747b5;
  border-color: #1747b5;
  outline-color: rgba(30, 89, 224, .4);
}

@media (max-width: 920px) {
  .board-catalog {
    grid-template-columns: 1fr;
  }

  .portal-section-head-row,
  .device-bind-form,
  .my-device-card {
    grid-template-columns: 1fr;
  }

  .portal-section-head-row {
    align-items: stretch;
  }

  .device-open {
    width: 100%;
  }

  .portal-header {
    flex-direction: column;
  }

  .portal-header-actions {
    position: static;
    flex-wrap: wrap;
    justify-content: center;
  }

  .portal-copy h2 {
    font-size: 32px;
  }
}

.admin-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.admin-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
}

.admin-header h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-summary div,
.admin-panel {
  border: 1px solid var(--border);
  background: var(--surface);
}

.admin-summary div {
  padding: 14px;
  border-radius: var(--radius);
}

.admin-summary span {
  display: block;
  color: var(--text-3);
  font-size: 12px;
}

.admin-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.admin-grid {
  display: grid;
  gap: 14px;
}

.admin-table-wrap {
  overflow: auto;
}

.telemetry-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.telemetry-insight-card {
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .03);
}

.telemetry-insight-card.wide {
  grid-column: span 3;
}

.telemetry-insight-card > span {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

.telemetry-insight-card strong {
  display: block;
  font-size: 24px;
}

.telemetry-insight-card ul {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.telemetry-insight-card li {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}

.telemetry-insight-card li b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
}

.telemetry-insight-card li span {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.telemetry-insight-card em {
  color: var(--text-3);
  font-style: normal;
  font-size: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
}

.ok-text {
  color: var(--green);
}

.danger-text {
  color: var(--red);
}

@media (max-width: 860px) {
  .telemetry-insights {
    grid-template-columns: 1fr;
  }

  .telemetry-insight-card.wide {
    grid-column: auto;
  }
}

.asset-manager-drawer {
  width: min(860px, calc(100vw - 24px));
  background: #f8fafc;
  color: #0f172a;
}

.asset-manager-drawer .drawer-head {
  background: #ffffff;
  border-bottom-color: #e4ecfc;
}

.asset-manager-drawer .kicker,
.asset-manager-drawer .drawer-head h2 {
  color: #0f172a;
}

.asset-manager-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
  height: calc(100vh - 66px);
  background: #f8fafc;
}

.asset-projects {
  border-right: 1px solid #e4ecfc;
  padding: 10px;
  overflow: auto;
  background: #f1f5fd;
}

.asset-section-title {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.asset-project-list {
  display: grid;
  gap: 4px;
}

.asset-project-item {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #0f172a;
  text-align: left;
  transition: background .16s ease, border-color .16s ease;
}

.asset-project-item:hover {
  background: #ffffff;
  border-color: #e4ecfc;
}

.asset-project-item.active {
  border-color: #bfdbfe;
  background: #dbeafe;
}

.asset-project-item strong {
  display: block;
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-project-item span,
.asset-manager-toolbar p {
  color: #64748b;
  font-family: var(--mono);
  font-size: 11px;
}

.asset-files-pane {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  padding: 12px;
  background: #ffffff;
}

.asset-manager-toolbar {
  display: grid;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e4ecfc;
}

.asset-manager-titlebar {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.asset-manager-path {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-nav-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.asset-breadcrumb {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #e4ecfc;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  white-space: nowrap;
}

.asset-breadcrumb-link {
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font-size: 12px;
}

.asset-breadcrumb-link:hover {
  text-decoration: underline;
}

.asset-breadcrumb-separator,
.asset-breadcrumb-current {
  color: #64748b;
}

.asset-command-bar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.asset-command-bar .ghost-btn {
  min-height: 30px;
  padding: 0 10px;
  border-color: #dbeafe;
  background: #ffffff;
  color: #2563eb;
  font-size: 12px;
}

.asset-command-bar .ghost-btn:hover {
  background: #eff6ff;
}

.asset-command-bar .ghost-btn:disabled {
  cursor: default;
  opacity: .45;
}

.asset-command-bar .ghost-btn.danger {
  color: #dc2626;
  border-color: #fee2e2;
}

.asset-table-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 100px 90px 150px;
  gap: 10px;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #e4ecfc;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}

.asset-table-head.folder-mode {
  display: none;
}

.asset-file-list {
  overflow: auto;
  padding: 10px 2px 2px;
}

.asset-explorer.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  align-content: start;
  gap: 10px;
}

.asset-folder-tile {
  min-width: 0;
  height: 112px;
  display: grid;
  grid-template-rows: 46px auto auto;
  justify-items: center;
  gap: 4px;
  padding: 10px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #0f172a;
  text-align: center;
  transition: background .16s ease, border-color .16s ease;
}

.asset-folder-tile:hover {
  background: #f8fafc;
  border-color: #e4ecfc;
}

.asset-folder-tile.selected {
  background: #dbeafe;
  border-color: #93c5fd;
}

.asset-folder-icon {
  width: 48px;
  height: 42px;
  color: #2563eb;
}

.asset-folder-icon svg {
  width: 100%;
  height: 100%;
}

.asset-folder-name {
  max-width: 100%;
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-folder-meta {
  color: #64748b;
  font-size: 11px;
}

.asset-file-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 100px 90px 150px;
  gap: 10px;
  min-height: 38px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #0f172a;
}

.asset-file-row:hover {
  background: #f8fafc;
}

.asset-file-row.selected {
  background: #dbeafe;
  border-color: #93c5fd;
}

.asset-file-name {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-file-icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: #d97706;
}

.asset-file-icon svg,
.asset-file-icon svg.image,
.asset-file-icon svg.video,
.asset-file-icon svg.audio,
.asset-file-icon svg.other {
  width: 20px;
  height: 20px;
}

.asset-file-icon svg.image { color: #2563eb; }
.asset-file-icon svg.video { color: #7c3aed; }
.asset-file-icon svg.audio { color: #059669; }
.asset-file-icon svg.other { color: #d97706; }

.asset-file-kind,
.asset-file-size {
  color: #64748b;
  font-size: 12px;
}

.asset-file-usage select {
  width: 100%;
  min-height: 28px;
  border: 1px solid #e4ecfc;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
}

.asset-empty-state {
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  color: #64748b;
  text-align: center;
  font-size: 13px;
}

.asset-context-menu {
  position: fixed;
  z-index: 35;
  min-width: 144px;
  padding: 4px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .22);
}

.asset-context-menu button {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #0f172a;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.asset-context-menu button:hover {
  background: #eff6ff;
}

.asset-properties-panel {
  width: min(460px, calc(100vw - 36px));
  background: #ffffff;
  color: #0f172a;
}

.asset-properties-panel .drawer-head {
  background: #ffffff;
  border-bottom-color: #e4ecfc;
}

.asset-properties-body {
  display: grid;
  gap: 1px;
  padding: 12px;
  background: #e4ecfc;
}

.asset-property-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  background: #ffffff;
  font-size: 12px;
}

.asset-property-row span {
  color: #64748b;
}

.asset-property-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-weight: 500;
}

.asset-import-modal {
  background: rgba(0, 0, 0, .54);
}

.asset-import-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  border-color: rgba(255, 255, 255, .14);
  background: rgba(16, 18, 24, .68);
  backdrop-filter: blur(18px) saturate(1.25);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .65);
}

.asset-import-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.asset-import-screen {
  display: grid;
  gap: 18px;
  padding: 34px 28px 28px;
  color: #fff;
  font-family: SimSun, "Songti SC", "Noto Serif SC", serif;
  text-align: center;
}

.asset-import-screen h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
}

.asset-import-screen p {
  margin: 0;
  color: rgba(255, 255, 255, .86);
  font-size: 16px;
  line-height: 1.7;
}

.asset-import-upload {
  text-align: left;
}

.asset-import-heading {
  display: grid;
  gap: 8px;
  padding-right: 38px;
  text-align: left;
}

.asset-import-heading .kicker {
  color: rgba(255, 255, 255, .6);
  font-family: var(--mono);
}

.asset-folder-picker-btn {
  min-height: 44px;
  border-color: #fff;
  background: #fff;
  color: #000;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}

.asset-folder-picker-btn:hover {
  border-color: #fff;
  background: #fff;
  color: #000;
}

.asset-drop-zone {
  min-height: 170px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, .32);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .05);
  color: #fff;
  text-align: center;
}

.asset-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.asset-drop-zone strong {
  font-size: 17px;
}

.asset-drop-zone span {
  color: rgba(255, 255, 255, .68);
  font-family: var(--sans);
  font-size: 12px;
}

@media (max-width: 760px) {
  .workspace,
  .device-area {
    height: auto;
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: 0;
  }

  .agent-panel {
    min-height: 560px;
  }

  .board-strip {
    grid-template-columns: 1fr;
  }

  .device-stage {
    padding: 24px;
  }

  .mac {
    transform: none;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 10px;
  }

  .topbar {
    height: auto;
    min-height: 96px;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .board-facts {
    grid-template-columns: 1fr 1fr;
  }

  .cap-list {
    grid-template-columns: repeat(2, auto);
    justify-content: start;
  }

  .mac {
    width: min(560px, 100%);
    padding: 26px 24px 62px;
  }
}

/* Deploy to Market Button */
.deploy-market-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(240, 240, 240, .24);
  transition: all 0.15s ease;
  z-index: 10;
}

.deploy-market-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 14px rgba(240, 240, 240, .32);
}

.deploy-market-btn svg {
  width: 20px;
  height: 20px;
  color: var(--vb-black, #010101);
}

.device-card {
  position: relative;
}

/* Deploy Modal Form */
#deployMarketForm label {
  display: block;
  margin-bottom: 12px;
}

#deployMarketForm label span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-2);
}

#deployMarketForm input,
#deployMarketForm textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
}

#deployMarketForm input:focus,
#deployMarketForm textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.deploy-action {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.deploy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--vb-black, #010101);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
}

.deploy-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240, 240, 240, .24);
}

.deploy-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.deploy-btn.done {
  background: var(--green);
}

/* Unified dark treatment for asset management surfaces */
.asset-manager-drawer,
.asset-properties-panel {
  background: var(--surface);
  color: var(--text);
}

.asset-manager-drawer .drawer-head,
.asset-properties-panel .drawer-head {
  background: var(--surface);
  border-bottom-color: var(--border);
}

.asset-manager-drawer .kicker,
.asset-manager-drawer .drawer-head h2 {
  color: var(--text);
}

.asset-manager-layout,
.asset-files-pane {
  background: var(--surface);
}

.asset-projects {
  border-right-color: var(--border);
  background: rgba(10, 15, 26, .64);
}

.asset-section-title,
.asset-project-item span,
.asset-manager-toolbar p,
.asset-breadcrumb-separator,
.asset-breadcrumb-current,
.asset-folder-meta,
.asset-file-kind,
.asset-file-size,
.asset-property-row span {
  color: var(--text-2);
}

.asset-project-item,
.asset-folder-tile,
.asset-file-row {
  color: var(--text);
}

.asset-project-item:hover,
.asset-folder-tile:hover,
.asset-file-row:hover {
  background: rgba(255, 255, 255, .045);
  border-color: rgba(255, 255, 255, .08);
}

.asset-project-item.active,
.asset-folder-tile.selected,
.asset-file-row.selected {
  background: var(--accent-dim);
  border-color: var(--accent-ring);
}

.asset-project-item strong,
.asset-folder-name,
.asset-file-name,
.asset-property-row strong {
  color: var(--text);
}

.asset-manager-toolbar,
.asset-table-head {
  border-bottom-color: var(--border);
}

.asset-breadcrumb,
.asset-command-bar .ghost-btn,
.asset-file-usage select {
  border-color: var(--border);
  background: rgba(1, 1, 1, .72);
  color: var(--text);
}

.asset-breadcrumb-link,
.asset-folder-icon,
.asset-file-icon svg.image,
.asset-command-bar .ghost-btn {
  color: var(--accent);
}

.asset-command-bar .ghost-btn:hover,
.asset-context-menu button:hover {
  background: var(--accent-dim);
}

.asset-command-bar .ghost-btn.danger {
  border-color: rgba(239, 68, 68, .28);
  color: #fca5a5;
}

.asset-empty-state {
  border-color: rgba(255, 255, 255, .1);
  color: var(--text-2);
}

.asset-context-menu {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 8px 14px rgba(0, 0, 0, .45);
}

.asset-context-menu button {
  color: var(--text);
}

.asset-properties-body {
  background: var(--border);
}

.asset-property-row {
  background: var(--surface);
}

/* Welcome block */
.welcome-block {
  line-height: 1.6;
}
.welcome-greeting {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.suggestion-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: var(--surface-2, rgba(255,255,255,.04));
  color: var(--text, #e2e8f0);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.suggestion-btn:hover {
  background: rgba(56,189,248,.12);
  border-color: rgba(56,189,248,.3);
  transform: translateY(-1px);
}

/* Thinking bubble */
.thinking-msg .thinking-body {
  background: rgba(139,92,246,.08);
  border: 1px solid rgba(139,92,246,.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
}
.thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text, #c4b5fd);
}
.thinking-header:hover {
  color: #a78bfa;
}
.thinking-icon {
  font-size: 16px;
}
.thinking-toggle {
  margin-left: auto;
  font-size: 11px;
  opacity: .6;
}
.thinking-content {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(139,92,246,.15);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary, #94a3b8);
  max-height: 300px;
  overflow-y: auto;
}
.thinking-content p {
  margin: 0 0 4px;
}
/* Thinking animation */
.thinking-active {
  animation: thinkingPulse 1.5s ease-in-out infinite;
}
.thinking-dots {
  animation: thinkingDots 1.2s steps(3) infinite;
  display: inline-block;
  width: 1.5em;
  text-align: left;
}
@keyframes thinkingPulse {
  0%, 100% { opacity: .7; }
  50% { opacity: 1; }
}
@keyframes thinkingDots {
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}

/* Agent actions card */
.agent-card {
  background: rgba(16,185,129,.06);
  border: 1px solid rgba(16,185,129,.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.agent-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  color: var(--text, #6ee7b7);
  font-weight: 600;
}
.agent-card-header:hover { color: #34d399; }
.agent-toggle {
  margin-left: auto;
  font-size: 11px;
  opacity: .6;
}
.agent-actions-list {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(16,185,129,.15);
}
.agent-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
}
.agent-action-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.agent-action-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-card {
  background: var(--ai-soft);
  border-color: var(--ai-ring);
}

.evidence-mode {
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 10px;
  line-height: 1.4;
}

.evidence-mode.real {
  border-color: rgba(34, 197, 94, .36);
  color: #86efac;
}

.evidence-mode.sim {
  border-color: var(--ai-ring);
  color: #b99cff;
}

.evidence-list {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ai-ring);
  gap: 5px;
}

.evidence-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 24px;
  color: var(--text-secondary, #94a3b8);
  font-size: 12px;
}

.evidence-item b {
  overflow: hidden;
  color: #e2e8f0;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-item.pass b { color: #86efac; }
.evidence-item.fail b { color: #fca5a5; }
.evidence-item.skip b,
.evidence-item.pending b { color: #F0F0F0; }

/* ─── Markdown Body ─── */
.markdown-body {
  font-family: var(--sans);
  line-height: 1.65;
  word-break: break-word;
}
.markdown-body h1 { font-size: 18px; margin: 12px 0 8px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); padding-bottom: 4px; }
.markdown-body h2 { font-size: 15px; margin: 12px 0 6px; font-weight: 600; }
.markdown-body h3 { font-size: 14px; margin: 10px 0 4px; font-weight: 600; }
.markdown-body p { margin: 6px 0; }
.markdown-body strong { font-weight: 600; color: var(--text, #e2e8f0); }
.markdown-body em { font-style: italic; opacity: .9; }
.markdown-body ul, .markdown-body ol { margin: 6px 0; padding-left: 20px; }
.markdown-body li { margin: 2px 0; }
.markdown-body blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--accent-ring, rgba(240, 240, 240, .32));
  background: var(--accent-soft, rgba(240, 240, 240, .08));
  border-radius: var(--radius);
  color: var(--text-secondary, #94a3b8);
  font-size: 13px;
}
.markdown-body code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(255,255,255,.08);
  padding: 1px 5px;
  border-radius: 4px;
}
.markdown-body pre {
  margin: 8px 0;
  padding: 10px;
  background: rgba(0,0,0,.3);
  border-radius: var(--radius);
  overflow-x: auto;
}
.markdown-body pre code {
  background: none;
  padding: 0;
  font-size: 12px;
  line-height: 1.5;
}
.markdown-body a {
  color: var(--accent, #6366f1);
  text-decoration: none;
}
.markdown-body a:hover {
  text-decoration: underline;
}
.markdown-body hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,.1);
  margin: 12px 0;
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 13px;
}
.markdown-body th, .markdown-body td {
  border: 1px solid rgba(255,255,255,.1);
  padding: 6px 10px;
  text-align: left;
}
.markdown-body th {
  background: rgba(255,255,255,.05);
  font-weight: 600;
}

/* ─── Inline Actions (buttons in chat) ─── */
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.inline-actions .btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.12);
  transition: all .15s;
  font-family: var(--sans);
}
.inline-actions .btn:hover {
  transform: translateY(-1px);
}
.inline-actions .btn-primary {
  background: var(--accent, #6366f1);
  color: var(--vb-black, #010101);
  border-color: var(--accent, #6366f1);
}
.inline-actions .btn-primary:hover {
  background: #FFFFFF;
}
.inline-actions .btn-ghost {
  background: var(--surface-2, rgba(255,255,255,.04));
  color: var(--text-secondary, #94a3b8);
}
.inline-actions .btn-ghost:hover {
  background: var(--surface-3, rgba(255,255,255,.08));
  color: var(--text, #e2e8f0);
}

.mode-boundary-note {
  border-color: rgba(126, 59, 237, .22) !important;
  background: rgba(126, 59, 237, .08) !important;
  color: var(--text-2) !important;
  font-size: 12px !important;
}

.codex-bridge-note {
  border-color: rgba(34, 197, 94, .18) !important;
  background: rgba(34, 197, 94, .055) !important;
  color: var(--text-2) !important;
  font-size: 12px !important;
}

.codex-bridge-warning {
  border-color: rgba(245, 158, 11, .25) !important;
  background: rgba(245, 158, 11, .075) !important;
}

.build-confirmation {
  display: grid;
  gap: 10px;
  max-width: 100%;
}

.confirm-copy {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}

.confirm-copy strong {
  color: var(--text);
  font-size: 13px;
}

.confirm-copy ul {
  margin: 0 0 4px 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.confirm-copy li {
  overflow-wrap: anywhere;
}

/* Electric Glass platform theme: black glass, lime activation, purple AI depth. */
body.calm-consumer-shell {
  color-scheme: dark;
  --vb-theme-name: Electric Glass;
  --vb-black: #010101;
  --vb-white: #F0F0F0;
  --vb-lime: #F0F0F0;
  --vb-purple: #7E3BED;
  --bg: var(--vb-black);
  --surface: #09090b;
  --surface-2: #111114;
  --panel: #09090b;
  --panel-2: #111114;
  --panel-3: #18181d;
  --accent: var(--vb-lime);
  --accent-dim: rgba(240, 240, 240, .13);
  --accent-soft: rgba(240, 240, 240, .08);
  --accent-ring: rgba(240, 240, 240, .32);
  --ai: var(--vb-purple);
  --ai-dim: rgba(126, 59, 237, .18);
  --ai-soft: rgba(126, 59, 237, .1);
  --ai-ring: rgba(126, 59, 237, .36);
  --border: rgba(240, 240, 240, .1);
  --line: rgba(240, 240, 240, .16);
  --line-soft: rgba(240, 240, 240, .07);
  --blue: var(--ai);
  --amber: #F0F0F0;
  --muted: #d7d7df;
  --subtle: #b6b6c1;
  --dim: #858590;
  --text: var(--vb-white);
  --text-2: #c8c8d0;
  --text-3: #858590;
  --green: var(--vb-lime);
  --red: #ff5a6c;
  --radius: 8px;
  --mono: "Cascadia Code", Consolas, monospace;
  --sans: "Segoe UI", "Noto Sans SC", "Microsoft YaHei UI", system-ui, sans-serif;
}

body.calm-consumer-shell,
body.calm-consumer-shell .shell,
body.calm-consumer-shell .sidebar {
  background:
    linear-gradient(180deg, rgba(126, 59, 237, .1), transparent 28%),
    linear-gradient(0deg, rgba(240, 240, 240, .04), transparent 38%),
    var(--bg);
  color: var(--text);
}

body.calm-consumer-shell .sidebar {
  background: #050506;
  border-right-color: var(--border);
}

body.calm-consumer-shell .sidebar-header,
body.calm-consumer-shell .sidebar-footer,
body.calm-consumer-shell .topbar,
body.calm-consumer-shell .panel-head,
body.calm-consumer-shell .device-toolbar,
body.calm-consumer-shell .composer {
  border-color: var(--border);
  background: var(--surface);
}

body.calm-consumer-shell .sidebar-header {
  padding: 16px 14px;
}

body.calm-consumer-shell .brand-name,
body.calm-consumer-shell h1,
body.calm-consumer-shell h2,
body.calm-consumer-shell h3,
body.calm-consumer-shell h4,
body.calm-consumer-shell strong {
  color: var(--text);
}

body.calm-consumer-shell .brand-name,
body.calm-consumer-shell h1 {
  font-family: var(--sans);
}

body.calm-consumer-shell .brand-name {
  color: var(--vb-white);
}

body.calm-consumer-shell .brand p,
body.calm-consumer-shell .kicker,
body.calm-consumer-shell .head-copy,
body.calm-consumer-shell .composer label,
body.calm-consumer-shell .asset-state,
body.calm-consumer-shell .agent-mode-select,
body.calm-consumer-shell .conv-item .conv-time {
  color: var(--text-2);
}

body.calm-consumer-shell .mark {
  border-color: var(--border);
  border-radius: 8px;
  background: #050506;
}

body.calm-consumer-shell .mark span:first-child { background: var(--accent); }
body.calm-consumer-shell .mark span:nth-child(2) { background: var(--ai); }
body.calm-consumer-shell .mark span:nth-child(3) { background: var(--vb-white); }

body.calm-consumer-shell .ghost-btn,
body.calm-consumer-shell .icon-btn,
body.calm-consumer-shell .prompt-row button,
body.calm-consumer-shell .tabs button {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}

body.calm-consumer-shell .ghost-btn:hover,
body.calm-consumer-shell .icon-btn:hover,
body.calm-consumer-shell .prompt-row button:hover,
body.calm-consumer-shell .tabs button:hover {
  border-color: var(--accent-ring);
  background: var(--accent-dim);
  color: var(--accent);
}

body.calm-consumer-shell .primary-btn,
body.calm-consumer-shell .deploy-market-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--vb-black);
}

body.calm-consumer-shell .primary-btn:hover,
body.calm-consumer-shell .deploy-market-btn:hover {
  background: #FFFFFF;
}

body.calm-consumer-shell .market-link {
  border-color: transparent;
  color: var(--accent);
}

body.calm-consumer-shell .market-link:hover,
body.calm-consumer-shell .conv-item:hover,
body.calm-consumer-shell .conv-item.active {
  border-color: var(--accent-ring);
  background: var(--accent-dim);
}

body.calm-consumer-shell .conv-item.active {
  color: var(--text);
}

body.calm-consumer-shell .workspace {
  background:
    linear-gradient(90deg, rgba(126, 59, 237, .12), transparent 34%),
    linear-gradient(270deg, rgba(240, 240, 240, .07), transparent 40%),
    var(--bg);
}

body.calm-consumer-shell .agent-panel,
body.calm-consumer-shell .hardware-panel,
body.calm-consumer-shell .drawer,
body.calm-consumer-shell .device-card {
  border-color: var(--border);
  background: var(--surface);
}

body.calm-consumer-shell .pill,
body.calm-consumer-shell .credit-chip,
body.calm-consumer-shell .cap {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}

body.calm-consumer-shell .chat-log {
  background: #050506;
}

body.calm-consumer-shell .msg p,
body.calm-consumer-shell .stage-card,
body.calm-consumer-shell .work-log,
body.calm-consumer-shell .stage,
body.calm-consumer-shell .board-facts div,
body.calm-consumer-shell .runtime-grid div,
body.calm-consumer-shell .verify-item,
body.calm-consumer-shell .usage-summary div,
body.calm-consumer-shell .usage-row,
body.calm-consumer-shell .usage-empty,
body.calm-consumer-shell .job-card {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}

body.calm-consumer-shell .msg.user p,
body.calm-consumer-shell .msg.user .stage-card {
  border-color: var(--ai-ring);
  background: var(--ai-dim);
}

body.calm-consumer-shell .avatar {
  border-color: var(--border);
  background: var(--panel-3);
  color: var(--accent);
}

body.calm-consumer-shell .stage.active {
  border-color: var(--ai-ring);
  background: var(--ai-soft);
}

body.calm-consumer-shell .stage.active i {
  background: var(--ai);
  box-shadow: 0 0 8px var(--ai-ring);
}

body.calm-consumer-shell textarea,
body.calm-consumer-shell .agent-mode-select select,
body.calm-consumer-shell .device-select,
body.calm-consumer-shell #deployMarketForm input,
body.calm-consumer-shell #deployMarketForm textarea,
body.calm-consumer-shell .model-form input,
body.calm-consumer-shell .model-form select {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

body.calm-consumer-shell textarea:focus,
body.calm-consumer-shell .agent-mode-select select:focus,
body.calm-consumer-shell .device-select:focus,
body.calm-consumer-shell #deployMarketForm input:focus,
body.calm-consumer-shell #deployMarketForm textarea:focus,
body.calm-consumer-shell .model-form input:focus,
body.calm-consumer-shell .model-form select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

body.calm-consumer-shell .prompt-row button,
body.calm-consumer-shell .tool-btn {
  color: var(--accent);
}

body.calm-consumer-shell .tool-btn {
  border-color: var(--accent-ring);
  background: var(--accent-dim);
}

body.calm-consumer-shell .device-stage {
  background:
    linear-gradient(135deg, rgba(126, 59, 237, .18), transparent 46%),
    linear-gradient(315deg, rgba(240, 240, 240, .11), transparent 52%),
    #050506;
}

body.calm-consumer-shell .preview-loading-mask {
  background: #010101;
  color: var(--vb-white);
}

body.calm-consumer-shell .preview-loading-mask span {
  border-color: rgba(255, 255, 255, .24);
  border-top-color: var(--accent);
}

body.calm-consumer-shell .deploy-market-btn {
  border-radius: 8px;
  box-shadow: none;
}

body.calm-consumer-shell .drawer,
body.calm-consumer-shell .modal-panel,
body.calm-consumer-shell .account-menu {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

body.calm-consumer-shell .drawer-head,
body.calm-consumer-shell .job-toolbar,
body.calm-consumer-shell .usage-toolbar,
body.calm-consumer-shell .usage-summary,
body.calm-consumer-shell .account-menu-head {
  border-color: var(--border);
}

body.calm-consumer-shell .guide-grid section,
body.calm-consumer-shell .asset-drop-zone,
body.calm-consumer-shell .job-log-details,
body.calm-consumer-shell .confirm-copy {
  border-color: var(--border);
  background: var(--surface-2);
}

body.calm-consumer-shell .guide-grid p,
body.calm-consumer-shell .job-meta,
body.calm-consumer-shell .job-log,
body.calm-consumer-shell .model-help,
body.calm-consumer-shell .confirm-copy ul {
  color: var(--text-2);
}

body.calm-consumer-shell .asset-drop-zone {
  color: var(--text);
}

body.calm-consumer-shell .asset-drop-zone span {
  color: var(--text-2);
}

body.calm-consumer-shell .asset-folder-picker-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--vb-black);
  box-shadow: none;
}

body.calm-consumer-shell .cap.ok {
  border-color: var(--accent-ring);
  background: var(--accent-dim);
  color: var(--accent);
}

body.calm-consumer-shell .cap.warn {
  border-color: rgba(240, 240, 240, .32);
  background: rgba(240, 240, 240, .11);
  color: var(--amber);
}

body.calm-consumer-shell .deploy-log,
body.calm-consumer-shell pre {
  border-color: var(--border);
  background: #050506;
  color: var(--text-2);
}

@media (max-width: 720px) {
  body.calm-consumer-shell .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  body.calm-consumer-shell .top-actions > * {
    flex: 1 1 auto;
  }
}

@media (max-width: 1120px) {
  body.calm-consumer-shell .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: var(--sidebar-width);
    margin-left: 0;
    transform: translateX(0);
    box-shadow: 8px 0 14px rgba(0, 0, 0, .42);
    transition: transform .2s ease;
  }

  body.calm-consumer-shell .sidebar.collapsed {
    width: var(--sidebar-width);
    margin-left: 0;
    transform: translateX(-100%);
    pointer-events: none;
  }

  body.calm-consumer-shell .shell {
    width: 100%;
    min-width: 0;
  }

  body.calm-consumer-shell .top-left,
  body.calm-consumer-shell .top-left .brand,
  body.calm-consumer-shell .top-left .brand > div {
    min-width: 0;
  }

  body.calm-consumer-shell .top-left h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.calm-consumer-shell .top-actions {
    flex: none;
  }

  body.calm-consumer-shell .top-actions > * {
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  body.calm-consumer-shell .app-layout {
    min-height: 100vh;
    height: auto;
    overflow: visible;
  }

  body.calm-consumer-shell .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(84vw, 300px);
    margin-left: 0;
    transform: translateX(0);
    box-shadow: 8px 0 14px rgba(0, 0, 0, .42);
    transition: transform .2s ease;
  }

  body.calm-consumer-shell .sidebar.collapsed {
    width: min(84vw, 300px);
    margin-left: 0;
    transform: translateX(-100%);
    pointer-events: none;
  }

  body.calm-consumer-shell .shell {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    padding: 0;
    overflow: visible;
  }

  body.calm-consumer-shell .workspace {
    min-height: 0;
    overflow: visible;
  }

  body.calm-consumer-shell .topbar {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.calm-consumer-shell .sidebar {
    transition: none;
  }
}
