/* 参考工作台视觉：轻背景、白色卡片、清晰状态色和稳定的信息层级。 */
:root {
  --ref-bg: #f5f7fb;
  --ref-panel: #ffffff;
  --ref-ink: #162238;
  --ref-muted: #728099;
  --ref-line: #e3e8f0;
  --ref-blue: #315efb;
  --ref-blue-soft: #edf2ff;
  --ref-teal: #11a99b;
  --ref-teal-soft: #e8f8f5;
  --ref-orange: #f1a84b;
  --ref-orange-soft: #fff3e4;
  --ref-shadow: 0 8px 24px rgba(31, 55, 92, .06);
  --ref-radius: 13px;
}

html, body { background: var(--ref-bg); color: var(--ref-ink); }
body { font-family: "Inter", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif; }

.auth-screen {
  padding: 32px;
  background: radial-gradient(circle at 12% 12%, #eaf0ff 0, transparent 33%), var(--ref-bg);
}
.auth-shell {
  width: min(1080px, calc(100vw - 64px));
  min-height: min(680px, calc(100vh - 64px));
  height: auto;
  border: 1px solid var(--ref-line);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(33, 58, 97, .12);
}
.auth-intro { padding: 44px; background: linear-gradient(145deg, #2e58dc 0%, #3c6cf4 58%, #4d7cf1 100%); }
.auth-intro::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -120px;
  top: 170px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255, 255, 255, .04), 0 0 0 58px rgba(255, 255, 255, .03);
}
.auth-brand .brand-mark { background: rgba(255, 255, 255, .95); }
.auth-value { margin-top: 72px; }
.auth-kicker { color: #d5e0ff; letter-spacing: .08em; }
.auth-value h1 { max-width: 450px; font-size: 39px; letter-spacing: -.8px; }
.auth-feature-list { gap: 16px; margin-top: 30px; }
.auth-feature-list > div { grid-template-columns: 36px minmax(0, 1fr); }
.auth-feature-list i { width: 32px; height: 32px; border-color: rgba(255,255,255,.35); color: #fff; border-radius: 9px; }
.auth-deck-preview { right: 42px; bottom: 34px; border-radius: 13px; transform: rotate(-2deg); }
.auth-intro-footer { color: rgba(255,255,255,.62); }
.auth-panel { padding: 64px 66px 42px; }
.auth-copy { padding-bottom: 22px; }
.auth-copy > span { color: var(--ref-blue); letter-spacing: .04em; }
.auth-copy h2 { font-size: 30px; letter-spacing: -.4px; }
.auth-copy p { color: var(--ref-muted); }
.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 24px;
  padding: 4px;
  border: 1px solid var(--ref-line);
  border-radius: 10px;
  background: #f8faff;
}
.auth-mode-switch button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  color: var(--ref-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.auth-mode-switch button.is-active { color: var(--ref-blue); background: #fff; box-shadow: 0 2px 6px rgba(44, 83, 176, .12); }
.auth-form { gap: 16px; }
.auth-form label > span:first-child { color: #4f5d73; }
.auth-field-control { height: 50px; border-color: #d8dfeb; border-radius: 9px; }
.auth-field-control:focus-within { border-color: var(--ref-blue); box-shadow: 0 0 0 3px rgba(49,94,251,.1); }
.auth-code-button { min-height: 50px; border-color: #b9c9f9; border-radius: 9px; color: var(--ref-blue); background: var(--ref-blue-soft); }
.auth-password-control input { padding-right: 8px; }
.auth-password-control button {
  flex: none;
  min-width: 56px;
  height: 100%;
  padding: 0 10px;
  border: 0;
  border-left: 1px solid var(--ref-line);
  color: var(--ref-blue);
  background: #f8faff;
  font-size: 11px;
  font-weight: 700;
}
.auth-submit { min-height: 50px; border-radius: 9px; background: var(--ref-blue); box-shadow: 0 8px 16px rgba(49,94,251,.2); }
.auth-submit:hover:not(:disabled) { background: #284ed5; }
.auth-login-tip { margin: 14px 0 0; color: var(--ref-muted); font-size: 11px; line-height: 1.6; }
.auth-security-note { border-top-color: var(--ref-line); }
.auth-security-note > i { border-color: #6b8ae8; }
.auth-security-note > i::before { border-color: #6b8ae8; }

.app-shell { padding-left: 218px; background: var(--ref-bg); }
.studio-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 218px;
  padding: 26px 16px 18px;
  border-right: 1px solid var(--ref-line);
  background: rgba(255,255,255,.94);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 9px 28px; }
.sidebar-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #315efb, #6a82f4); box-shadow: 0 5px 12px rgba(49,94,251,.2); }
.sidebar-brand .brand-mark::before { background: #dbe4ff; }
.sidebar-brand .brand-mark::after { background: #aabbff; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { color: var(--ref-ink); font-size: 15px; font-weight: 800; }
.sidebar-brand span { margin-top: 3px; color: #9aa6b8; font-size: 9px; letter-spacing: .03em; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-section-label { margin: 0 10px 7px; color: #9aa6b8; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: #556278;
  background: transparent;
  text-align: left;
  font-size: 12px;
}
.sidebar-nav-item:hover { color: var(--ref-blue); background: #f4f7ff; }
.sidebar-nav-item.is-active { color: var(--ref-blue); background: var(--ref-blue-soft); }
.sidebar-nav-item b { font-weight: 700; }
.sidebar-icon { display: grid; place-items: center; width: 22px; height: 22px; color: currentColor; font-size: 18px; line-height: 1; }
.sidebar-nav-secondary { margin-top: 32px; }
.sidebar-spacer { flex: 1; min-height: 24px; }
.sidebar-credit-card { padding: 14px; border: 1px solid #dce5ff; border-radius: 12px; background: linear-gradient(135deg, #f2f5ff, #f9fbff); }
.sidebar-credit-card > span { display: block; color: var(--ref-muted); font-size: 10px; }
.sidebar-credit-card > strong { display: block; margin-top: 5px; color: var(--ref-ink); font-size: 21px; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.sidebar-credit-card button { display: flex; justify-content: space-between; width: 100%; margin-top: 10px; padding: 0; border: 0; color: var(--ref-blue); background: transparent; font-size: 11px; font-weight: 750; }
.sidebar-credit-card button span { font-size: 14px; }
.sidebar-footer { display: flex; align-items: center; gap: 9px; margin-top: 16px; padding: 11px 8px 0; border-top: 1px solid var(--ref-line); }
.sidebar-avatar { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; color: #fff; background: var(--ref-blue); font-size: 12px; font-weight: 800; }
.sidebar-footer > div { min-width: 0; flex: 1; }
.sidebar-footer strong, .sidebar-footer small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer strong { color: var(--ref-ink); font-size: 11px; }
.sidebar-footer small { margin-top: 3px; color: var(--ref-muted); font-size: 10px; }
.sidebar-footer button { width: 22px; height: 22px; border: 0; color: var(--ref-muted); background: transparent; font-size: 15px; transform: rotate(180deg); }
.sidebar-footer button:hover { color: var(--ref-blue); }
.app-shell .topbar {
  display: flex;
  height: 76px;
  padding: 16px 40px 12px;
  border-bottom: 1px solid var(--ref-line);
  background: rgba(255,255,255,.82);
  box-shadow: none;
  backdrop-filter: blur(14px);
}
.topbar-navigation, .app-shell .brand-lockup { display: none; }
.topbar-search { display: flex; align-items: center; width: min(520px, 50vw); height: 40px; padding: 0 12px; border: 1px solid #dce3ee; border-radius: 10px; background: #fff; }
.topbar-search > span { color: #8a97aa; font-size: 21px; line-height: 1; transform: rotate(-20deg); }
.topbar-search input { width: 100%; height: 100%; padding: 0 9px; border: 0; outline: none; color: var(--ref-ink); background: transparent; font-size: 12px; }
.topbar-search input::placeholder { color: #a3adbb; }
.topbar-search kbd { padding: 3px 6px; border: 1px solid #e1e6ee; border-radius: 5px; color: #a0aabb; background: #f7f9fc; font-size: 10px; white-space: nowrap; }
.app-shell .topbar-actions { margin-left: auto; gap: 12px; }
.credits-entry { border: 1px solid #dce3ee; border-radius: 9px; color: #526077; background: #fff; }
.credits-entry:hover { border-color: #b9c9f9; color: var(--ref-blue); background: #f8faff; }
.topbar-new-button { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 9px; color: #fff; background: var(--ref-blue); box-shadow: 0 6px 13px rgba(49,94,251,.18); font-size: 12px; font-weight: 750; }
.topbar-new-button:hover { background: #284ed5; transform: translateY(-1px); }
.topbar-new-button span { font-size: 17px; line-height: 1; }
.user-session .profile-entry { min-height: 40px; padding: 0 7px; border-radius: 50%; color: #fff; background: #315efb; }
.user-session .profile-entry svg { width: 18px; height: 18px; }
.user-session .profile-entry span, .user-session > #logoutButton { display: none; }
.app-shell .studio-layout { width: auto; max-width: none; margin: 0; padding: 28px 40px 58px; }
.app-shell .workspace-panel { padding-top: 0; }
.create-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 0 0 18px; text-align: left; }
.create-heading h1 { margin-top: 9px; color: var(--ref-ink); font-size: 31px; letter-spacing: -.7px; }
.create-heading p { margin-top: 7px; color: var(--ref-muted); font-size: 13px; }
.create-heading-status { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 5px; padding: 7px 11px; border: 1px solid #cfece6; border-radius: 999px; color: #138f83; background: var(--ref-teal-soft); font-size: 11px; font-weight: 700; white-space: nowrap; }
.create-heading-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ref-teal); box-shadow: 0 0 0 4px rgba(17,169,155,.12); }
.create-credit-note { justify-content: flex-start; margin: 0 0 18px; }
.create-credit-note > span { border-color: #dce5ff; color: #526077; background: #fff; }
.create-credit-note > span i { color: var(--ref-blue); }
.create-credit-note b { color: var(--ref-ink); }
.studio-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.studio-metric-card { position: relative; display: flex; align-items: center; gap: 12px; min-height: 108px; padding: 18px; overflow: hidden; border: 1px solid var(--ref-line); border-radius: var(--ref-radius); background: #fff; box-shadow: var(--ref-shadow); }
.metric-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 11px; font-size: 21px; }
.metric-blue .metric-icon { color: var(--ref-blue); background: var(--ref-blue-soft); }
.metric-teal .metric-icon { color: var(--ref-teal); background: var(--ref-teal-soft); }
.metric-orange .metric-icon { color: var(--ref-orange); background: var(--ref-orange-soft); }
.studio-metric-card small, .studio-metric-card strong, .studio-metric-card em { display: block; }
.studio-metric-card small { color: var(--ref-muted); font-size: 11px; }
.studio-metric-card strong { margin-top: 3px; color: var(--ref-ink); font-size: 20px; letter-spacing: -.3px; }
.studio-metric-card em { margin-top: 3px; color: #a0aabb; font-size: 10px; font-style: normal; }
.metric-spark { display: flex; align-items: end; gap: 4px; height: 33px; margin-left: auto; opacity: .55; }
.metric-spark i { display: block; width: 5px; border-radius: 4px 4px 0 0; background: currentColor; }
.metric-spark i:nth-child(1) { height: 9px; }.metric-spark i:nth-child(2) { height: 16px; }.metric-spark i:nth-child(3) { height: 12px; }.metric-spark i:nth-child(4) { height: 24px; }.metric-spark i:nth-child(5) { height: 31px; }
.metric-blue .metric-spark { color: #91aaff; }.metric-teal .metric-spark { color: #76d4cb; }.metric-orange .metric-spark { color: #f6c77d; }
.create-composer { max-width: 980px; padding: 25px 28px 0; border: 1px solid var(--ref-line); border-radius: var(--ref-radius); background: #fff; box-shadow: var(--ref-shadow); }
.create-composer .topic-field > span b { color: var(--ref-ink); font-size: 14px; }
.create-composer .topic-field textarea { min-height: 124px; margin-top: 12px; border: 1px solid #e1e6ef; border-radius: 10px; background: #fbfcfe; font-size: 15px; }
.create-composer .topic-field textarea:focus { border-color: #aebeff; box-shadow: 0 0 0 3px rgba(49,94,251,.08); outline: none; }
.creation-defaults { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.creation-defaults > span { padding: 7px 10px; border: 1px solid #e4e9f2; border-radius: 8px; color: #647189; background: #f8faff; font-size: 11px; }
.creation-defaults > span i { color: var(--ref-blue); }
.creation-defaults-hint { color: #97a3b4; }
.guide-start-actions { padding: 18px 0 22px; }
.guide-start-actions .primary-button { background: var(--ref-blue); box-shadow: 0 7px 14px rgba(49,94,251,.16); }
.guide-start-actions .primary-button:hover:not(:disabled) { background: #284ed5; }

.task-library-dialog { width: min(1080px, calc(100vw - 280px)); max-width: none; max-height: min(820px, calc(100vh - 80px)); border: 1px solid var(--ref-line); border-radius: 18px; background: var(--ref-bg); box-shadow: 0 24px 80px rgba(20, 39, 72, .18); }
.task-library-dialog::backdrop, .workspace-dialog::backdrop { background: rgba(25, 39, 66, .28); backdrop-filter: blur(3px); }
.task-library-dialog .workspace-dialog-head { padding: 24px 28px 18px; border-bottom: 1px solid var(--ref-line); background: #fff; }
.task-library-dialog .workspace-dialog-head strong { font-size: 24px; letter-spacing: -.3px; }
.task-library-toolbar { display: flex; align-items: end; gap: 10px; padding: 16px 28px; border-bottom: 1px solid var(--ref-line); background: #fff; }
.task-library-toolbar label { min-width: 0; }
.task-library-toolbar label:first-child { flex: 1; }
.task-library-toolbar label > span { color: var(--ref-muted); }
.task-library-toolbar input, .task-library-toolbar select { border-color: #dce3ee; border-radius: 8px; }
.task-library-toolbar .primary-button { background: var(--ref-blue); }
.task-library-summary { padding: 14px 28px 10px; color: var(--ref-muted); }
.task-library-list { display: grid; gap: 8px; padding: 0 28px 18px; overflow: auto; }
.task-library-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .75fr) auto; align-items: center; gap: 18px; padding: 15px 16px; border: 1px solid var(--ref-line); border-radius: 11px; background: #fff; box-shadow: 0 3px 10px rgba(35, 57, 93, .03); }
.task-library-row:hover { border-color: #c7d4fb; box-shadow: 0 6px 16px rgba(49,94,251,.08); }
.task-library-main strong { color: var(--ref-ink); font-size: 13px; }
.task-library-info { color: var(--ref-muted); }
.task-library-state .task-library-status { color: var(--ref-muted); }
.task-library-state .task-progress > div { background: #edf1f7; }
.task-library-state .task-progress i { background: var(--ref-blue); }
.task-row-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
.task-row-actions .secondary-button { min-height: 32px; border-color: #dce3ee; border-radius: 8px; color: #53627a; background: #fff; }
.workspace-dialog-footer { border-top-color: var(--ref-line); background: #fff; }
.visual-layout { border: 1px solid var(--ref-line); border-radius: var(--ref-radius); background: #fff; box-shadow: var(--ref-shadow); }
.visual-main-frame { border-color: var(--ref-line); background: #f7f9fc; }
.visual-review-panel { border-left-color: var(--ref-line); background: #fff; }
.visual-tool-tabs button[aria-selected="true"] { color: var(--ref-blue); border-bottom-color: var(--ref-blue); }
.visual-generation-progress { border-color: #dce5ff; background: #f8faff; }
.visual-generation-track span { background: var(--ref-blue); }

@media (max-width: 900px) {
  .auth-screen { padding: 18px; }
  .auth-shell { width: min(680px, calc(100vw - 36px)); min-height: 0; grid-template-columns: 1fr; }
  .auth-intro { min-height: 280px; padding: 28px; }
  .auth-value { margin-top: 36px; }
  .auth-value h1 { font-size: 30px; }
  .auth-feature-list, .auth-deck-preview, .auth-intro-footer { display: none; }
  .auth-panel { padding: 34px 30px 28px; }
  .app-shell { padding-left: 70px; }
  .studio-sidebar { width: 70px; padding: 20px 10px; }
  .sidebar-brand { justify-content: center; padding: 0 0 26px; }
  .sidebar-brand > div:last-child, .sidebar-section-label, .sidebar-nav-item b, .sidebar-credit-card, .sidebar-footer > div, .sidebar-footer button { display: none; }
  .sidebar-nav-item { justify-content: center; padding: 0; }
  .sidebar-footer { justify-content: center; padding-left: 0; padding-right: 0; }
  .app-shell .topbar { padding-left: 24px; padding-right: 24px; }
  .app-shell .studio-layout { padding: 24px; }
  .task-library-dialog { width: min(720px, calc(100vw - 100px)); }
}
@media (max-width: 640px) {
  .app-shell .topbar { height: 66px; padding: 12px 15px; }
  .topbar-search { width: min(240px, 48vw); }
  .topbar-search kbd, .credits-entry i, .credits-entry b, .topbar-new-button { display: none; }
  .app-shell .topbar-actions { gap: 5px; }
  .app-shell .studio-layout { padding: 20px 15px 40px; }
  .create-heading { display: block; }
  .create-heading-status { margin-top: 13px; }
  .studio-metrics { grid-template-columns: 1fr; }
  .metric-spark { display: none; }
  .create-composer { padding-left: 16px; padding-right: 16px; }
  .task-library-dialog { width: calc(100vw - 30px); max-height: calc(100vh - 30px); }
  .task-library-toolbar { flex-wrap: wrap; padding-left: 18px; padding-right: 18px; }
  .task-library-toolbar label:first-child { flex-basis: 100%; }
  .task-library-list { padding-left: 18px; padding-right: 18px; }
  .task-library-row { grid-template-columns: 1fr; gap: 10px; }
  .task-row-actions { justify-content: start; }
}

@media (prefers-reduced-motion: no-preference) {
  .studio-metric-card, .create-composer, .task-library-row { animation: ref-card-in .35s ease both; }
  .studio-metric-card:nth-child(2) { animation-delay: .04s; }
  .studio-metric-card:nth-child(3) { animation-delay: .08s; }
  @keyframes ref-card-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}

/* 页面主体保持统一的阅读宽度，标题、概览卡片和主题对话卡片共享同一条中轴线。 */
:root { --ref-content-width: 1360px; }
.app-shell .studio-layout {
  width: min(var(--ref-content-width), calc(100% - 48px));
  max-width: var(--ref-content-width);
  margin: 0 auto;
  padding: 30px 0 62px;
}
.app-shell .workspace-panels,
.app-shell .workspace-panel[data-workspace-panel="create"] {
  width: 100%;
}
.workspace-panel[data-workspace-panel="create"] > :is(.create-heading, .create-credit-note, .studio-metrics, .create-composer, .studio-assistant, .creation-guide, .studio-footer-note) {
  width: 100%;
  max-width: var(--ref-content-width);
  margin-left: auto;
  margin-right: auto;
}
.create-composer {
  max-width: var(--ref-content-width);
  width: 100%;
}
.studio-metrics { width: 100%; }
.create-heading { width: 100%; }

/* 侧栏图标按功能分色，避免把菜单做成一排相同的灰色符号。 */
.sidebar-nav-item .sidebar-icon {
  border: 1px solid currentColor;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  transition: transform .18s ease, box-shadow .18s ease;
}
.sidebar-nav-item:hover .sidebar-icon { transform: translateY(-1px); box-shadow: 0 4px 9px rgba(29, 50, 90, .12); }
.sidebar-nav-item[data-sidebar-action="create"] .sidebar-icon { color: #315efb; background: #edf2ff; }
.sidebar-nav-item[data-sidebar-action="tasks"] .sidebar-icon { color: #7659e8; background: #f1edff; }
.sidebar-nav-item[data-sidebar-action="recharge"] .sidebar-icon { color: #e49b37; background: #fff3df; }
.sidebar-nav-item[data-sidebar-action="models"] .sidebar-icon { color: #0ca597; background: #e7f8f4; }
.sidebar-nav-item[data-sidebar-action="profile"] .sidebar-icon { color: #3e9d68; background: #eaf7ee; }
.sidebar-nav-item.is-active .sidebar-icon { box-shadow: 0 0 0 3px rgba(49, 94, 251, .08); }

/* 窄屏保留文字，侧栏变成可读的紧凑导航，而不是只留下难以识别的图标。 */
@media (max-width: 900px) {
  .app-shell { padding-left: 164px; }
  .studio-sidebar {
    width: 164px;
    padding: 20px 12px 16px;
  }
  .sidebar-brand { justify-content: flex-start; padding: 0 5px 22px; }
  .sidebar-brand > div:last-child { display: block; }
  .sidebar-brand span { font-size: 8px; }
  .sidebar-section-label { display: block; margin-left: 8px; }
  .sidebar-nav-item {
    justify-content: flex-start;
    gap: 9px;
    min-height: 39px;
    padding: 0 9px;
  }
  .sidebar-nav-item b { display: block; font-size: 11px; }
  .sidebar-credit-card { display: block; padding: 11px; }
  .sidebar-credit-card > strong { font-size: 18px; }
  .sidebar-footer { justify-content: flex-start; padding-left: 4px; padding-right: 4px; }
  .sidebar-footer > div, .sidebar-footer button { display: block; }
  .sidebar-footer > div { flex: 1; }
  .sidebar-footer button { flex: none; }
  .app-shell .studio-layout {
    width: min(var(--ref-content-width), calc(100% - 36px));
    padding: 24px 0 48px;
  }
}
@media (max-width: 640px) {
  .app-shell { padding-left: 0; }
  .studio-sidebar {
    position: sticky;
    top: 0;
    inset: auto;
    z-index: 40;
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 58px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--ref-line);
    overflow-x: auto;
  }
  .sidebar-brand { flex: none; padding: 0 8px 0 0; }
  .sidebar-brand .brand-mark { width: 30px; height: 30px; }
  .sidebar-brand > div:last-child { display: none; }
  .sidebar-nav, .sidebar-nav-secondary { display: flex; flex: none; gap: 5px; margin: 0 0 0 8px; }
  .sidebar-section-label, .sidebar-spacer, .sidebar-credit-card, .sidebar-footer { display: none; }
  .sidebar-nav-item { width: auto; min-height: 36px; padding: 0 9px; white-space: nowrap; }
  .sidebar-nav-item b { font-size: 10px; }
  .sidebar-icon { width: 22px; height: 22px; }
  .app-shell .topbar { padding-left: 15px; padding-right: 15px; }
  .app-shell .studio-layout {
    width: calc(100% - 30px);
    padding: 20px 0 40px;
  }
}

/* 独立页面：沿用首页的背景、卡片和中轴线，不再把主要功能藏在弹窗里。 */
:root {
  --ref-page-gutter: max(24px, calc((100vw - var(--ref-content-width)) / 2));
}

.sidebar-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-nav-item[data-sidebar-action="create"] .sidebar-icon svg { stroke-width: 2.2; }
.sidebar-nav-item[data-sidebar-action="tasks"] .sidebar-icon svg { stroke-width: 1.7; }
.sidebar-nav-item[data-sidebar-action="recharge"] .sidebar-icon svg { stroke-width: 1.55; }
.sidebar-nav-item[data-sidebar-action="models"] .sidebar-icon svg { stroke-width: 1.65; }
.sidebar-nav-item[data-sidebar-action="profile"] .sidebar-icon svg { stroke-width: 1.7; }

/* 主内容区在右侧可用空间中居中，标题、概览卡片和创作卡片共享同一宽度。 */
.is-create-workspace .app-shell .studio-layout,
.is-visual-workspace .app-shell .studio-layout,
.is-delivery-workspace .app-shell .studio-layout {
  width: min(var(--ref-content-width), calc(100% - 48px));
  max-width: var(--ref-content-width);
  margin-inline: auto;
}
.is-create-workspace .app-shell .workspace-panels,
.is-create-workspace .app-shell .workspace-panel[data-workspace-panel="create"] {
  width: 100%;
}
.is-create-workspace .workspace-panel[data-workspace-panel="create"] > :is(.create-heading, .create-credit-note, .studio-metrics, .create-composer, .studio-assistant, .creation-guide, .studio-footer-note) {
  width: 100%;
  max-width: var(--ref-content-width);
  margin-inline: auto;
  box-sizing: border-box;
}
.is-create-workspace .create-composer {
  max-width: var(--ref-content-width);
  width: 100%;
  box-sizing: border-box;
}
.is-create-workspace .create-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 18px;
}
.is-create-workspace .create-heading > div { grid-column: 2; }
.is-create-workspace .create-heading-status { grid-column: 3; justify-self: end; }

/* 输入区提供可直接套用的主题示例，降低第一次使用的空白感。 */
.topic-examples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  color: #8b98aa;
  font-size: 11px;
}
.topic-examples button {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #dce5f1;
  border-radius: 999px;
  color: #536784;
  background: #f8faff;
  font-size: 11px;
}
.topic-examples button:hover {
  border-color: #b9c9f9;
  color: var(--ref-blue);
  background: var(--ref-blue-soft);
}

/* 页面路由打开后使用全屏工作台，关闭按钮返回首页路由。 */
body:has(.task-library-dialog[open]),
body:has(.credit-dialog[open]),
body:has(.creation-settings-drawer[open]),
body:has(.profile-drawer[open]) { overflow: hidden; }
.task-library-dialog[open],
.credit-dialog[open] {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--ref-bg);
  box-shadow: none;
}
.task-library-dialog::backdrop,
.credit-dialog::backdrop {
  background: var(--ref-bg);
  backdrop-filter: none;
}
.task-library-dialog .workspace-dialog-head,
.task-library-dialog .task-library-toolbar,
.task-library-dialog .task-library-summary,
.task-library-dialog .task-library-list,
.task-library-dialog .workspace-dialog-footer,
.credit-dialog .workspace-dialog-head,
.credit-dialog .credit-scroll-area,
.credit-dialog .workspace-dialog-footer {
  padding-left: var(--ref-page-gutter);
  padding-right: var(--ref-page-gutter);
}
.task-library-dialog .workspace-dialog-head,
.credit-dialog .workspace-dialog-head {
  padding-top: 28px;
  padding-bottom: 22px;
  border-bottom-color: var(--ref-line);
  background: #fff;
}
.task-library-dialog .workspace-dialog-head > div,
.credit-dialog .workspace-dialog-head > div,
.task-library-dialog .task-library-toolbar > *,
.credit-dialog .credit-scroll-area > * {
  max-width: var(--ref-content-width);
}
.task-library-dialog .task-library-toolbar {
  grid-template-columns: minmax(240px, 1fr) 170px 150px auto auto;
  background: #fff;
}
.task-library-dialog .task-library-summary {
  padding-top: 18px;
  padding-bottom: 12px;
}
.task-library-dialog .task-library-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.task-library-dialog .workspace-dialog-footer,
.credit-dialog .workspace-dialog-footer {
  min-height: 64px;
  border-top-color: var(--ref-line);
  background: #fff;
}
.credit-dialog .credit-scroll-area {
  flex: 1;
  min-height: 0;
  padding-top: 28px;
  padding-bottom: 32px;
}
.credit-dialog .credit-scroll-area > * { width: 100%; margin-inline: auto; }
.credit-dialog .credit-balance-card {
  background: linear-gradient(135deg, #315efb, #597bf2);
}
.credit-dialog .credit-tabs button[aria-selected="true"] {
  color: var(--ref-blue);
  background: var(--ref-blue-soft);
}

/* 模型状态独立页只保留检测结论；详细模型选择仍在首页的默认设置抽屉中。 */
body.is-model-page .creation-settings-drawer[open] {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--ref-bg);
  box-shadow: none;
}
body.is-model-page .creation-settings-drawer::backdrop { background: var(--ref-bg); }
body.is-model-page .creation-settings-drawer-head {
  padding-inline: var(--ref-page-gutter);
  background: #fff;
}
body.is-model-page .creation-settings-drawer-body {
  width: min(var(--ref-content-width), calc(100% - 48px));
  margin-inline: auto;
  padding: 30px 0 50px;
}
body.is-model-page .creation-settings-drawer-body > .drawer-setting-section:not(.model-health-section),
body.is-model-page .creation-settings-drawer-body > .creation-disclosure,
body.is-model-page .creation-settings-drawer-body > #creationRequirements,
body.is-model-page .creation-settings-drawer-body > #actionHint,
body.is-model-page .creation-settings-drawer-body > button {
  display: none !important;
}
body.is-model-page .model-health-section {
  padding: 0;
  border: 0;
}
body.is-model-page .model-health-card {
  min-height: 150px;
  padding: 22px;
  border-color: var(--ref-line);
  background: #fff;
  box-shadow: var(--ref-shadow);
}
body.is-model-page .model-health-item.is-ready > i {
  background: var(--ref-teal);
  box-shadow: 0 0 0 3px rgba(17, 169, 155, .12);
}
body.is-model-page .model-health-refresh {
  border-color: #b9c9f9;
  color: var(--ref-blue);
  background: var(--ref-blue-soft);
}
body.is-model-page .model-health-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
body.is-model-page .creation-settings-drawer-foot { display: none; }

/* 个人资料独立页保留同一中轴线和账户卡片。 */
body.is-profile-page .profile-drawer[open] {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--ref-bg);
  box-shadow: none;
}
body.is-profile-page .profile-drawer::backdrop { background: var(--ref-bg); }
body.is-profile-page .profile-drawer .workspace-dialog-head,
body.is-profile-page .profile-drawer .profile-footer {
  padding-left: var(--ref-page-gutter);
  padding-right: var(--ref-page-gutter);
  background: #fff;
}
body.is-profile-page .profile-avatar {
  background: linear-gradient(135deg, #315efb, #6a82f4);
}
body.is-profile-page .profile-identity {
  border-color: #dce5ff;
  background: linear-gradient(115deg, #f0f4ff, #fbfcff);
}
body.is-profile-page .profile-footer .primary-button {
  border-color: transparent;
  color: #fff;
  background: var(--ref-blue);
  box-shadow: 0 7px 14px rgba(49, 94, 251, .16);
}
body.is-profile-page .profile-scroll-area {
  width: min(760px, calc(100% - 48px));
  margin-inline: auto;
  padding: 34px 0 48px;
}
body.is-profile-page .profile-footer { display: flex; justify-content: center; }
body.is-profile-page .profile-footer > * { width: min(760px, 100%); }
body.is-profile-page .profile-footer .primary-button { width: auto; min-width: 180px; }

@media (max-width: 1100px) {
  .is-create-workspace .app-shell .studio-layout,
  .is-visual-workspace .app-shell .studio-layout,
  .is-delivery-workspace .app-shell .studio-layout {
    width: min(var(--ref-content-width), calc(100% - 36px));
  }
  body.is-model-page .model-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --ref-page-gutter: 24px; }
  .is-create-workspace .create-heading {
    display: block;
    text-align: center;
  }
  .is-create-workspace .create-heading > div,
  .is-create-workspace .create-heading-status { display: block; }
  .is-create-workspace .create-heading-status { width: fit-content; margin: 14px auto 0; }
  .task-library-dialog .task-library-toolbar { grid-template-columns: 1fr 1fr; }
  .task-library-dialog .task-library-toolbar label:first-child { grid-column: 1 / -1; }
  .task-library-dialog .task-library-toolbar .primary-button,
  .task-library-dialog .task-library-toolbar .secondary-button { min-height: 40px; }
  body.is-model-page .creation-settings-drawer-body,
  body.is-profile-page .profile-scroll-area { width: min(100% - 36px, var(--ref-content-width)); }
}

@media (max-width: 640px) {
  :root { --ref-page-gutter: 15px; }
  .topic-examples { align-items: flex-start; }
  .topic-examples > span { width: 100%; }
  .task-library-dialog .workspace-dialog-head,
  .credit-dialog .workspace-dialog-head { padding-top: 20px; padding-bottom: 16px; }
  .task-library-dialog .task-library-toolbar { grid-template-columns: 1fr; }
  .task-library-dialog .task-library-toolbar label:first-child { grid-column: auto; }
  .task-library-dialog .task-library-list { padding-top: 4px; }
  .credit-dialog .credit-scroll-area { padding-top: 20px; }
  body.is-model-page .creation-settings-drawer-body,
  body.is-profile-page .profile-scroll-area { width: calc(100% - 30px); }
  body.is-model-page .model-health-grid { grid-template-columns: 1fr; }
  body.is-model-page .model-health-card { padding: 16px; }
  body.is-profile-page .profile-footer { padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)); }
  body.is-profile-page .profile-footer .primary-button { width: 100%; }
}

/* 独立页从侧栏右侧展开，侧栏始终留在视野中并保持当前选中状态。 */
:root {
  --ref-sidebar-width: 218px;
  --ref-page-gutter: max(24px, calc((100vw - var(--ref-sidebar-width) - var(--ref-content-width)) / 2));
}
.task-library-dialog[open],
.credit-dialog[open],
body.is-model-page .creation-settings-drawer[open],
body.is-profile-page .profile-drawer[open] {
  inset: 0 0 0 var(--ref-sidebar-width);
  width: auto;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border-radius: 0;
}
.task-library-dialog::backdrop,
.credit-dialog::backdrop,
body.is-model-page .creation-settings-drawer::backdrop,
body.is-profile-page .profile-drawer::backdrop {
  background: transparent;
  backdrop-filter: none;
}
body.is-model-page .creation-settings-drawer-body {
  width: min(var(--ref-content-width), calc(100% - 48px));
}
body.is-profile-page .profile-scroll-area {
  width: min(760px, calc(100% - 48px));
}

@media (max-width: 900px) {
  :root {
    --ref-sidebar-width: 164px;
    --ref-page-gutter: max(24px, calc((100vw - var(--ref-sidebar-width) - var(--ref-content-width)) / 2));
  }
}

@media (max-width: 640px) {
  :root { --ref-sidebar-width: 0px; --ref-page-gutter: 15px; }
  .task-library-dialog[open],
  .credit-dialog[open],
  body.is-model-page .creation-settings-drawer[open],
  body.is-profile-page .profile-drawer[open] {
    inset: 58px 0 0;
    height: calc(100dvh - 58px);
  }
}
