.top-title b { font-size: 18px; }
.top-title span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--surface); min-height: 40px; padding: 8px 13px; border-radius: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.content { padding: 28px; max-width: 1440px; margin: auto; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.025em; margin: 0; }
.page-head p { margin: 7px 0 0; color: var(--text); max-width: 68ch; }
.status-strip { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-bottom: 24px; }
.service { padding: 17px 19px; border-right: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.service:last-child { border-right: 0; }
.service strong { display: block; }
.service small { color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-head span { font-size: 12px; color: var(--muted); }
.task-list { display: grid; }
.task { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 17px 20px; display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; text-align: left; }
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--surface2); }
.task-key { width: 34px; height: 34px; border-radius: 10px; background: var(--surface2); display: grid; place-items: center; color: var(--accent); font: 700 13px/1 monospace; }
.task b { display: block; }
.task small { color: var(--muted); display: block; margin-top: 2px; }
.arrow { color: var(--muted); }
.recent { padding: 6px 18px 14px; }
.history-row { padding: 12px 2px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; }
.history-row:last-child { border-bottom: 0; }
.kind { font: 600 11px monospace; text-transform: uppercase; color: var(--info); }
.history-row small { color: var(--muted); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.workbench { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 20px; }
.form-panel { padding: 22px; }
.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field label { font-weight: 650; font-size: 13px; }
.field .hint, .hint { font-size: 12px; color: var(--muted); }
.model-profile { margin: -4px 0 18px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); }
.model-profile b { display: block; font-size: 13px; margin-bottom: 3px; }
.model-profile span { color: var(--text); font-size: 12px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 12px; outline: none; }
textarea { resize: vertical; min-height: 112px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { min-width: 0; }
.row .grow { flex: 1; }
.result { margin-top: 18px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface2); min-height: 90px; white-space: pre-wrap; overflow-wrap: anywhere; }
.result.loading { color: var(--muted); }
.context-history { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.context-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.context-head h3 { margin: 0; font-size: 14px; }
.context-head span { color: var(--muted); font-size: 12px; }
.context-list { display: grid; }
.context-row { display: grid; grid-template-columns: 70px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.context-row:last-child { border-bottom: 0; }
.context-row b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.context-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.history-action { border: 1px solid var(--line); background: var(--surface); min-height: 32px; padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.history-action:hover { border-color: var(--accent); color: var(--accent); }
.inspector { padding: 20px; align-self: start; position: sticky; top: 92px; }
.inspector h3 { font-size: 14px; margin: 0 0 14px; }
.meta { display: grid; grid-template-columns: 88px 1fr; gap: 9px; font-size: 12px; margin-bottom: 16px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.code { background: #171a17; color: #d8ded4; border-radius: 10px; padding: 13px; font: 12px/1.6 "SFMono-Regular", monospace; overflow: auto; white-space: pre-wrap; position: relative; }
.copy { position: absolute; right: 6px; top: 6px; border: 0; border-radius: 6px; background: #2b302a; color: #d8ded4; padding: 4px 7px; font-size: 10px; }
.tabs { display: flex; gap: 4px; background: var(--surface2); padding: 4px; border-radius: 10px; width: max-content; margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; padding: 8px 13px; border-radius: 7px; }
.tabs button.active { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 650; }
.model-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.model-toolbar input { max-width: 360px; }
.model-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.model-header, .model-item { display: grid; grid-template-columns: minmax(240px,1.6fr) 110px 110px 130px 110px; gap: 12px; align-items: center; padding: 12px 16px; }
.model-header { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface2); }
.model-item { border-top: 1px solid var(--line); }
.model-item:hover { background: color-mix(in srgb,var(--surface2) 60%,transparent); }
.model-name b { display: block; }
.model-name small { color: var(--muted); font-family: monospace; }
.badge { display: inline-flex; width: max-content; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; background: var(--surface2); color: var(--text); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.history-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.history-head, .history-item { display: grid; grid-template-columns: 140px 90px 1fr 110px 100px; gap: 12px; padding: 12px 16px; align-items: center; }
.history-head { background: var(--surface2); color: var(--muted); font-size: 11px; text-transform: uppercase; }
.history-item { border-top: 1px solid var(--line); font-size: 13px; }
.history-item:hover { background: var(--surface2); }
.api-list { display: grid; gap: 10px; }
.api-row { display: grid; grid-template-columns: 72px 250px 1fr; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); align-items: center; }
.method { font: 700 11px monospace; color: var(--info); }
.job { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface2); }
.progress { height: 5px; background: var(--line); border-radius: 10px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; width: 45%; background: var(--accent); animation: indeterminate 1.2s infinite var(--ease); }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(240%); } }
.media-result img, .media-result video { max-width: 100%; border-radius: 12px; margin-top: 14px; background: #111; }
.toast { position: fixed; right: 22px; bottom: 22px; background: var(--ink); color: var(--bg); padding: 11px 15px; border-radius: 10px; transform: translateY(20px); opacity: 0; transition: .2s var(--ease); z-index: 30; }
.toast.show { transform: none; opacity: 1; }
dialog { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--ink); width: min(440px,calc(100vw - 32px)); box-shadow: 0 24px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(12,14,12,.55); backdrop-filter: blur(4px); }
.login { padding: 26px; }
.login h2 { margin: 0 0 7px; font-size: 22px; }
.login p { color: var(--text); margin: 0 0 20px; }
.login .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.mobile-menu { display: none; }
html, body { max-width: 100%; overflow-x: hidden; }
.main, .content, .view, .panel, .status-strip, .quick-grid, .workbench { min-width: 0; max-width: 100%; }
@media (max-width:980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; width: 260px; transform: translateX(-102%); transition: .2s var(--ease); box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .mobile-menu { display: inline-flex; }
  .workbench, .quick-grid { grid-template-columns: 1fr; }
  .inspector { position: static; }
  .status-strip { grid-template-columns: 1fr; }
  .service { border-right: 0; border-bottom: 1px solid var(--line); }
  .service:last-child { border-bottom: 0; }
  .model-header { display: none; }
  .model-item { grid-template-columns: 1fr 90px; }
  .model-item > *:nth-child(3), .model-item > *:nth-child(4) { display: none; }
  .history-head { display: none; }
  .history-item { grid-template-columns: 110px 70px 1fr; }
  .history-item > *:nth-child(4), .history-item > *:nth-child(5) { display: none; }
  .api-row { grid-template-columns: 60px 1fr; }
  .api-row > *:last-child { grid-column: 1/-1; }
  .content { padding: 20px; }
  .topbar { padding: 0 18px; }
}
@media (max-width:620px) {
  .topbar { gap: 8px; }
  .topbar > .top-actions:first-child { flex: 1 1 auto; min-width: 0; }
  .topbar > .top-actions:last-child { flex: 0 0 auto; }
  .top-title { min-width: 0; overflow: hidden; }
  .top-title b, .top-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #themeBtn { display: none; }
  #loginBtn { min-width: 50px; padding-inline: 10px; }
  #loginBtn .user-label { display: none; }
  #loginBtn::after { content: "密钥"; font-size: 13px; }
  .btn { min-height: 44px; }
  .page-head { align-items: start; flex-direction: column; }
  .row { align-items: stretch; flex-direction: column; }
  .model-toolbar { flex-direction: column; }
  .model-toolbar input { max-width: none; }
  .content { padding: 16px; }
  .topbar { height: 60px; }
  .task { grid-template-columns: 34px 1fr; }
  .task .arrow { display: none; }
  .panel-head > span { display: none; }
  .context-head { align-items: flex-start; }
  .context-row { grid-template-columns: 56px minmax(0,1fr) auto; }
}
@media (prefers-reduced-motion:reduce) { * { animation: none !important; transition: none !important; } }
