@import "../modules/conversation/ui/theme/tokens.css";
@import "./brand.css";
.workbench-setup-details {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: max-content; max-width: min(360px, 85vw);
  display: grid; gap: 8px;
  pointer-events: none;
}
.workbench-setup-details > * { pointer-events: auto; }
.workbench-miaobi-key-hint { position: absolute; top: calc(50% + 20px); right: 0; width: max-content; padding: 3px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--popover); color: var(--muted); font: inherit; font-size: 10px; line-height: 1.4; white-space: nowrap; cursor: pointer; }
.workbench-miaobi-key-hint[hidden] { display: none; }
.workbench-miaobi-key-hint::before { content: ''; position: absolute; right: 11px; top: -3px; width: 4px; height: 4px; transform: rotate(45deg); background: var(--popover); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.workbench-miaobi-key-hint:hover { color: var(--warning); border-color: var(--line-strong); }
.workbench-balances {
  position: relative; display: grid; gap: 6px; padding: 9px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: linear-gradient(135deg, var(--panel), var(--popover)); color: var(--ink); font-size: 11px; box-shadow: var(--popover-shadow);
}
.workbench-balances[hidden], .workbench-balance-badge[hidden] { display: none; }
.workbench-balance-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; padding: 0 3px; }
.workbench-balances .workbench-balance-caption button { padding: 0 4px; font-size: 16px; line-height: 1; }
.workbench-balance-badge { justify-self: end; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--popover); color: var(--warning); cursor: pointer; font: inherit; font-size: 13px; }
.workbench-balance-badge:hover { border-color: var(--warning); }
.workbench-balance-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.workbench-balances button {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  background: transparent; color: inherit; border: 0; border-radius: 4px;
  font: inherit; text-align: left; padding: 6px 7px; cursor: pointer;
}
.workbench-balances strong { white-space: nowrap; font-weight: 600; }
.workbench-balances button:hover { background: var(--line); }
.workbench-balances button:focus-visible { outline: 2px solid var(--accent); }
.workbench-balances button[data-status="unset"], .workbench-balances button[data-status="error"] { color: var(--warning); }
/* Compact provider card: gold key quota, separate wallet and coin amounts. */
.workbench-balances::before { content: ''; position: absolute; right: 16px; top: -5px; width: 8px; height: 8px; background: var(--popover); border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong); transform: rotate(45deg); }
.workbench-balances button[data-channel="miaobi"] { padding: 3px 4px 9px; border-bottom: 1px solid var(--line); border-radius: 0; }
.workbench-balances button[data-channel="miaobi"] strong { color: var(--warning); }
.workbench-balances button[data-channel="cn"], .workbench-balances button[data-channel="international"] { border: 1px solid var(--line); background: color-mix(in srgb, var(--line) 22%, transparent); border-radius: 6px; }
.workbench-balances button[data-channel]:hover { background: var(--line); }
.workbench-balances strong, .workbench-balance-value, .workbench-balance-amount { display: inline-flex; align-items: center; gap: 6px; }
.workbench-balance-value { justify-content: flex-end; min-width: 0; font-variant-numeric: tabular-nums; }
.workbench-balance-amount { white-space: nowrap; padding-left: 8px; border-left: 1px solid var(--line); }
.workbench-balance-amount small { font: inherit; color: var(--muted); font-size: 10px; }
.workbench-balance-icon { width: 14px; height: 14px; flex: none; }
.balance-feather { width: 17px; height: 17px; color: var(--warning); }
.balance-wallet { color: var(--accent-ink); }
.balance-coin { color: var(--warning); }
.balance-info { color: var(--muted); }
.workbench-setup .workbench-setup-hint { position: static; width: auto; }
:root {
  font-family: "Segoe UI Variable Text", "Microsoft YaHei UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: transparent;
  padding: 12px 20px 20px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.workbench-bar {
  position: relative;
  z-index: 2;
  height: 64px;
  flex: none;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) auto auto;
  grid-template-rows: 64px;
  align-items: center;
  gap: 0 24px;
  padding: 0 8px;
  background: transparent;
}
.brand {
  transform: translateY(12px);
  grid-row: 1;
  grid-column: 1;
  flex: none;
  width: 240px;
  height: 48px;
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}
.brand img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: contain;
  image-rendering: auto;
}
.module-tabs {
  position: relative;
  grid-row: 1;
  grid-column: 2;
  justify-self: start;
  margin-left: 24px;
  transform: translateY(6px);
  display: flex;
  align-items: center;
  gap: 24px;
}
.module-tabs::before {
  content: "";
  position: absolute;
  left: -24px;
  top: calc(50% - 12px);
  width: 1px;
  height: 24px;
  background: var(--line);
  pointer-events: none;
}
.module-tabs button {
  position: relative;
  isolation: isolate;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 6px 18px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.module-tabs button:hover {
  color: var(--ink);
}
.module-tabs button[aria-selected="true"] {
  color: var(--ink);
}
.module-tabs button::before {
  content: "";
  position: absolute;
  inset: -10px -12px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, var(--focus-color), transparent 74%);
  opacity: 0;
}
.module-tabs button[aria-selected="true"]::before {
  opacity: .44;
  animation: module-backlight 3.6s ease-in-out infinite;
}
@keyframes module-backlight {
  0%, 100% { opacity: .36; transform: scale(.96); }
  50% { opacity: .58; transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .module-tabs button[aria-selected="true"]::before { animation: none; opacity: .46; }
}
.module-tabs button::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: calc(50% - 12px);
  width: 24px;
  height: 2px;
  background: transparent;
}
.module-tabs button:hover::after {
  background: var(--muted);
}
.module-tabs button[aria-selected="true"]::after {
  background: var(--focus-color);
}
button:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}
.local-label {
  grid-row: 1;
  grid-column: 3;
  margin-left: auto;
  color: var(--warning);
  font-size: 12px;
  text-decoration: none;
}
.local-label { max-width: 240px; line-height: 1.5; }
.desktop-online-label { display: inline-flex; align-items: center; width: 240px; height: 36px; overflow: hidden; white-space: nowrap; }
.desktop-online-rotator { position: relative; display: block; width: 100%; height: 1.5em; }
.desktop-online-line { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(60%); animation: online-label-rotate 6s ease-in-out infinite; }
.desktop-online-line:last-child { animation-delay: -3s; }
@keyframes online-label-rotate { 0%, 42% { opacity: 1; transform: translateY(0); } 50% { opacity: 0; transform: translateY(-60%); } 92% { opacity: 0; transform: translateY(60%); } 100% { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .desktop-online-label { height: auto; } .desktop-online-rotator { height: auto; } .desktop-online-line { position: static; transform: none; opacity: 1; animation: none; } }
html[data-runtime="web"] .local-label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 11px; font-weight: 500; }
html[data-runtime="web"] .local-label-icon { font-size: 13px; line-height: 1; }
.local-label:hover { color: var(--warning); }
.local-label:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 4px;
}
.workbench-bar .window-controls { grid-row: 1; grid-column: 4; }
main {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  flex: 1;
  min-height: 0;
}
.module-panel {
  height: 100%;
  width: 100%;
}
.module-panel.workbench-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
}
/* Keep the shared modal above the caption and its compact setup hint. */
.desktop-surface > main:has(#conversationPanel.workbench-settings-overlay) { z-index: 30; }
.module-panel[hidden],
iframe[hidden],
[hidden] {
  display: none !important;
}
iframe {
  border: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}
.module-status {
  padding: 48px;
  color: var(--muted);
  font-size: 14px;
}
@media (max-width: 750px) {
  .workbench-bar {
    padding: 0 12px;
    column-gap: 12px;
  }
  .local-label {
    display: none;
  }
  .desktop-online-label { display: none; }
  html[data-runtime="web"] .local-label { display: none; }
  .module-tabs button {
    padding: 6px 10px;
  }
  .module-tabs { margin-left: 12px; }
  .module-tabs::before { left: -12px; }
}

.workbench-actions { grid-row: 1; grid-column: 3; display: flex; align-items: center; gap: 16px; }
#workbenchSettings { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--accent-ink); border-bottom: 3px solid var(--primary-soft); border-radius: 7px; background: var(--accent-ink); color: var(--bg); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
#workbenchSettings:hover { background: var(--primary-hover); border-color: var(--primary-hover); border-bottom-color: var(--accent-ink); }
#desktopDownloadLink:focus-visible, #workbenchSettings:focus-visible, .workbench-setup-hint:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 3px; }
.workbench-setup { position: relative; display: inline-flex; }
.workbench-setup-hint { position: absolute; top: calc(100% + 8px); right: 0; max-width: min(300px, 80vw); width: max-content; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--popover); color: var(--warning); font: inherit; font-size: 12px; line-height: 1.5; text-align: left; cursor: pointer; }
.workbench-setup-hint[hidden] { display: none; }
.workbench-setup-hint:hover { border-color: var(--warning); background: var(--surface); }
#workbenchSettings.needs-setup::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
#workbenchSettingsStatus { color: var(--danger); font-size: 12px; }
#workbenchSettingsStatus:empty { display: none; }

#desktopDownloadLink { color: var(--warning); font-size: 12px; font-weight: 500; line-height: 1.5; text-decoration: none; white-space: normal; text-align: center; }
#desktopDownloadLink:hover { text-decoration: underline; text-underline-offset: 3px; }
#workbenchSettings svg { width: 20px; height: 20px; stroke-width: 2; }
#workbenchSettings:active { border-bottom-width: 1px; padding-top: 10px; }

/* Settings, resource slot and balance form one compact header action row. */
.workbench-setup { padding-right: 80px; align-items: center; pointer-events: none; }
.workbench-setup > button { pointer-events: auto; }
.workbench-setup > .workbench-balance-badge { position: absolute; right: 0; top: 50%; transform: translateY(-50%); border-color: var(--warning); }
