:root {
  --console-blue: #2454f5;
  --console-blue-dark: #173bc5;
  --console-bg: #f3f6fb;
  --console-line: #e2e7f0;
  --console-text: #17223a;
  --console-muted: #758198;
  --console-card: #ffffff;
}

body.console-page {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--console-bg);
  color: var(--console-text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.console-page .bg-orb {
  display: none;
}

.console-layout {
  min-height: 100vh;
}

.console-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: 236px;
  flex-direction: column;
  border-right: 1px solid var(--console-line);
  background: #fff;
}

.console-brand {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--console-line);
  padding: 0 18px;
}

.console-brand-mark,
.account-avatar {
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #1946eb, #5476ff);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(36, 84, 245, .22);
}

.console-brand-mark {
  width: 36px;
  height: 36px;
}

.console-brand > div,
.console-account > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.console-brand strong {
  color: #18233b;
  font-size: 15px;
}

.console-brand span,
.console-account span {
  color: #8a94a8;
  font-size: 11px;
}

.console-page .tabs.console-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  border: 0;
  padding: 18px 12px;
}

.console-page .tab-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 11px 12px;
  color: #526078;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  box-shadow: none;
}

.console-page .tab-btn:hover {
  background: #f4f7fc;
  color: #1f3358;
}

.console-page .tab-btn.active {
  background: linear-gradient(135deg, var(--console-blue-dark), var(--console-blue));
  color: #fff;
  box-shadow: 0 10px 22px rgba(36, 84, 245, .22);
}

.nav-glyph {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #d7deeb;
  border-radius: 7px;
  color: #758198;
  font: 700 9px/1 ui-monospace, Consolas, monospace;
}

.tab-btn.active .nav-glyph {
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}

.console-sidebar-footer {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 7px;
  border-top: 1px solid var(--console-line);
  padding: 16px 18px;
  color: #657189;
  font-size: 12px;
}

.console-sidebar-footer small {
  color: #a0a9ba;
}

.health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #25b981;
  box-shadow: 0 0 0 4px rgba(37, 185, 129, .12);
}

.console-stage {
  min-height: 100vh;
  margin-left: 236px;
}

.console-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--console-line);
  background: rgba(255, 255, 255, .94);
  padding: 12px 28px;
  backdrop-filter: blur(14px);
}

.console-topbar h1 {
  margin: 1px 0 0;
  color: #17223a;
  font-size: 21px;
  letter-spacing: -.02em;
}

.console-eyebrow,
.section-kicker {
  margin: 0;
  color: #8a95aa;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.console-account {
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.console-account strong {
  color: #24314a;
  font-size: 12px;
}

.logout-btn {
  margin-left: 5px;
}

.console-page .shell.console-content {
  display: block;
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px;
}

.console-page .tab-pane {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.console-page .tab-pane.active {
  display: flex;
  animation: console-fade .18s ease;
}

@keyframes console-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.console-page .card {
  border: 1px solid var(--console-line);
  border-radius: 14px;
  background: var(--console-card);
  box-shadow: 0 8px 28px rgba(39, 55, 87, .06);
  color: var(--console-text);
  padding: 22px;
  backdrop-filter: none;
}

.console-page h2 {
  color: #1d2941;
}

.console-page .muted,
.console-page .help,
.console-page .hint {
  color: var(--console-muted);
}

.console-page button {
  border: 0;
  border-radius: 9px;
  background: var(--console-blue);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

.console-page button:hover {
  filter: brightness(.97);
}

.console-page button.secondary,
.console-page .preview-download {
  border: 1px solid #dce2ed;
  background: #f7f9fc;
  color: #46536b;
}

.console-page button.danger {
  border: 1px solid #f2c7cc;
  background: #fff3f4;
  color: #bd4655;
}

.console-page .input-text,
.console-page .input-select,
.console-page input[type="text"],
.console-page input[type="password"],
.console-page input[type="number"],
.console-page select,
.console-page textarea {
  border-color: #dce2ed;
  background: #fff;
  color: #24314a;
}

.console-page .input-text:focus,
.console-page .input-select:focus,
.console-page input:focus,
.console-page textarea:focus,
.console-page select:focus {
  border-color: #7895ff;
  outline: 3px solid rgba(36, 84, 245, .1);
}

.console-page .token-summary,
.console-page .config-category-tabs,
.console-page .daily-stats-card,
.console-page .stat-card {
  border-color: #e3e8f1;
  background: #f8faff;
}

/* 这排汇总原来沿用深色皮肤的配色(标签 --muted、数字近白 #e7f1fd),
   放到白底上几乎看不见,这里按浅色台面重新定色号并加重。 */
.console-page .token-summary {
  gap: 26px;
  border-radius: 12px;
  padding: 12px 16px;
  color: #4a5670;
  font-size: 14px;
  font-weight: 600;
}

.console-page .token-summary strong {
  margin-left: 4px;
  color: #16203a;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.console-page .config-cat-btn {
  border-color: transparent;
  background: #eef2f8;
  color: #657189;
}

.console-page .config-cat-btn.active {
  background: #e7edff;
  color: #244fdc;
}

.console-page table {
  /* 原来正文 #34415a + 继承小字号,在白底上对比度不足、扫读吃力,
     这里统一提高字号与色深;关键列(账号/积分)再单独加重。 */
  color: #1f2a44;
  font-size: 14px;
}

.console-page th {
  border-color: #e7ebf2;
  background: #f7f9fc;
  color: #55617a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}

.console-page td {
  border-color: #edf0f5;
  font-size: 14px;
  line-height: 1.55;
  color: #1f2a44;
}

/* 账号名/邮箱这类主标识,加粗提高辨识度 */
.console-page td a,
.console-page td strong {
  color: #17223a;
  font-weight: 600;
}

/* 数字类(积分、失败次数)用等宽,列对齐更好读 */
.console-page td .mono,
.console-page table code {
  font-family: "SFMono-Regular", "SF Mono", Consolas, Menlo, monospace;
  font-size: 13.5px;
  color: #1f2a44;
}

/* 次要信息(重置时间、有效期)保持弱化但不至于看不清 */
.console-page td small,
.console-page td .muted {
  color: #5c6880;
  font-size: 12.5px;
}

.console-page tbody tr:hover {
  background: #f8faff;
}

.console-page .empty-state {
  color: #8a95a9;
}

.console-page .dialog-modal,
.console-page .preview-modal {
  background: rgba(23, 34, 58, .38);
}

.console-page .dialog-card,
.console-page .preview-modal-dialog {
  border-color: #dce2ed;
  background: #fff;
  color: #24314a;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  border: 1px solid var(--console-line);
  border-radius: 14px;
  background: #fff;
  padding: 19px;
  box-shadow: 0 8px 24px rgba(39, 55, 87, .05);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--console-muted);
}

.metric-card span {
  font-size: 12px;
  font-weight: 600;
}

.metric-card strong {
  display: block;
  margin: 7px 0 5px;
  color: #17223a;
  font-size: 30px;
  letter-spacing: -.03em;
}

.metric-card small {
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr);
  gap: 16px;
}

.dashboard-card h2 {
  margin-top: 5px;
}

.dashboard-usage-card {
  display: grid;
  gap: 12px;
}

.dashboard-stats-head {
  align-items: flex-end;
  margin-bottom: 2px;
}

.dashboard-stats-head h2 {
  margin: 5px 0 0;
}

.dashboard-stats-head .actions {
  align-items: center;
}

.dashboard-stats-head .input-select {
  min-width: 112px;
}

.dashboard-usage-card .stats-grid {
  margin-bottom: 0;
}

.dashboard-usage-card .stat-card {
  min-height: 92px;
  background: #f8faff;
  padding: 16px;
}

.console-page .stat-value {
  color: #17223a;
}

.dashboard-credit-card {
  display: grid;
  gap: 12px;
}

.dashboard-credit-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.dashboard-credit-stats .stat-card {
  min-height: 88px;
  padding: 16px;
}

.stat-card-sub-pool {
  border-left: 4px solid #2454f5 !important;
}

.stat-card-credit-pool {
  border-left: 4px solid #18a879 !important;
}

.console-page .credits-gridline {
  stroke: #e3e8f1;
}

.console-page .credits-axis-label {
  fill: #758198;
}

.console-page .credits-chart-tooltip {
  border-color: #dce2ed;
  background: #fff;
  color: #24314a;
  box-shadow: 0 10px 28px rgba(39, 55, 87, .16);
}

.console-page .credits-chart-tooltip .tt-sub { color: #2454f5; }
.console-page .credits-chart-tooltip .tt-credit { color: #13835d; }
.console-page .credits-chart-tooltip .tt-total {
  margin-top: 4px;
  border-top: 1px solid #e5e9f1;
  padding-top: 4px;
  font-weight: 700;
}

.dashboard-stats-help {
  margin: 0;
}

.model-stats-help {
  margin: 0 0 12px;
}

.model-stats-table-wrap {
  max-height: 340px;
  overflow: auto;
}

#modelCallStatsTable {
  min-width: 560px;
}

#modelCallStatsTable th:not(:first-child),
#modelCallStatsTable td:not(:first-child) {
  text-align: right;
}

.model-name-cell {
  max-width: 320px;
  color: #24314a;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
  word-break: break-word;
}

.model-success-cell {
  color: #13835d;
}

.model-failure-cell {
  color: #c43d4d;
  font-weight: 700;
}

.dashboard-row-list {
  display: grid;
  gap: 2px;
  margin-top: 16px;
}

.dashboard-row-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #edf0f5;
  padding: 13px 0;
}

.dashboard-row-list span {
  color: #707c92;
  font-size: 13px;
}

.dashboard-row-list strong {
  color: #24314a;
}

body.console-login-page {
  min-height: 100vh;
  margin: 0;
  background: #f3f6fb;
  color: var(--console-text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.login-console-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 44%) 1fr;
}

.login-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 46px;
  background:
    radial-gradient(circle at 20% 15%, rgba(126, 151, 255, .65), transparent 26%),
    linear-gradient(145deg, #102da7, #2655ee);
  color: #fff;
}

.login-brand-panel h1 {
  max-width: 520px;
  margin: 18px 0 10px;
  color: #fff;
  font-size: clamp(34px, 5vw, 62px);
  letter-spacing: -.05em;
}

.login-brand-panel p {
  max-width: 480px;
  color: rgba(255, 255, 255, .72);
  line-height: 1.7;
}

.login-brand-inline {
  display: flex;
  align-items: center;
  gap: 11px;
}

.login-form-stage {
  display: grid;
  place-items: center;
  padding: 32px;
}

.console-login-card {
  width: min(440px, 100%);
  border: 1px solid var(--console-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(41, 56, 89, .1);
  padding: 32px;
}

.console-login-card h2 {
  margin: 0 0 7px;
  color: #17223a;
  font-size: 27px;
}

.console-login-card .form-group {
  display: grid;
  gap: 7px;
}

.console-login-card label {
  color: #48556d;
  font-size: 13px;
  font-weight: 600;
}

.console-login-card input {
  width: 100%;
  border: 1px solid #dce2ed;
  border-radius: 9px;
  padding: 12px;
  color: #24314a;
}

.console-login-card button {
  width: 100%;
  border: 0;
  border-radius: 9px;
  margin-top: 20px;
  background: var(--console-blue);
  padding: 11px 18px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.console-login-card .form-group + .form-group {
  margin-top: 15px;
}

.login-card-intro {
  margin: 0 0 24px;
  color: #7b869b;
  font-size: 13px;
}

.login-message {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 12px;
}

.login-hint {
  margin: 15px 0 0;
  color: #9aa4b6;
  font-size: 11px;
  text-align: center;
}

/* Public image playground follows the same sidebar and card language. */
body.studio-page {
  --rail-width: 236px;
  min-height: 100vh;
  background: #f3f6fb;
  color: #24314a;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.studio-page .bg-orb {
  display: none;
}

.studio-page .workspace-rail {
  width: var(--rail-width);
  border-right: 1px solid #e1e6ef;
  background: #fff;
  padding: 0 12px 18px;
  box-shadow: none;
}

.studio-page .rail-brand {
  min-height: 74px;
  gap: 11px;
  border-bottom: 1px solid #edf0f5;
  padding: 0 12px;
}

.studio-page .rail-brand-mark {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 9px;
  background: #2147df;
  color: #fff;
}

.studio-page .rail-brand strong {
  color: #17223a;
  letter-spacing: 0;
}

.studio-page .rail-brand div span,
.studio-page .rail-section-label,
.studio-page .rail-footer {
  color: #8b96aa;
}

.studio-page .rail-section-label {
  padding: 22px 12px 9px;
}

.studio-page .rail-nav {
  gap: 5px;
}

.studio-page .rail-link {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  color: #526078;
}

.studio-page .rail-link:hover {
  background: #f1f4fa;
  color: #2147df;
}

.studio-page .rail-link.active {
  border: 0;
  background: #2147df;
  color: #fff;
  box-shadow: 0 10px 22px rgba(33, 71, 223, .2);
}

.studio-page .rail-footer {
  border-color: #edf0f5;
}

.studio-page .shell {
  width: min(1180px, calc(100vw - var(--rail-width) - 64px));
  margin: 30px auto 42px calc(var(--rail-width) + 32px);
  gap: 18px;
  border: 0;
  padding: 0;
}

.studio-page .card,
.studio-page .hero,
.studio-page .panel-grid > .card {
  border: 1px solid #e1e6ef;
  border-left: 1px solid #e1e6ef;
  border-radius: 14px;
  background: #fff;
  color: #24314a;
  box-shadow: 0 8px 24px rgba(39, 55, 87, .05);
  backdrop-filter: none;
}

.studio-page .hero {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 0;
  background:
    radial-gradient(circle at 78% 20%, rgba(115, 143, 255, .7), transparent 28%),
    linear-gradient(135deg, #102eaf 0%, #1d43d8 48%, #315dff 100%);
  color: #fff;
  box-shadow: 0 18px 36px rgba(31, 70, 213, .18);
}

.studio-page .hero h1 {
  color: #fff;
}

.studio-page .hero .kicker {
  color: #c7d5ff;
}

.studio-page .hero .muted {
  color: rgba(255, 255, 255, .75);
}

.studio-page h2 {
  color: #17223a;
}

.studio-page label {
  color: #526078;
  font-weight: 600;
}

.studio-page .field-hint,
.studio-page .muted,
.studio-page .mono {
  color: #7b869b;
}

.studio-page textarea,
.studio-page select,
.studio-page input {
  border-color: #dce2ed;
  border-radius: 9px;
  background: #fff;
  color: #24314a;
}

.studio-page button {
  border-radius: 9px;
  background: #2147df;
  color: #fff;
  box-shadow: 0 10px 22px rgba(33, 71, 223, .2);
}

.studio-page .progress-wrap {
  background: #e9edf5;
}

.studio-page .progress-bar {
  background: linear-gradient(90deg, #2147df, #5c7aff);
}

.studio-page .preview {
  border-color: #e1e6ef;
  background: #f7f9fc;
}

.studio-page .badge.idle,
.studio-page .badge.queued,
.studio-page .badge.in_progress,
.studio-page .badge.processing,
.studio-page .badge.running {
  border-color: #bdd0ff;
  background: #edf3ff;
  color: #2147df;
}

.studio-page .badge.succeeded {
  border-color: #afe1cb;
  background: #edf9f4;
  color: #13835d;
}

.studio-page .badge.failed {
  border-color: #efbdc4;
  background: #fff1f3;
  color: #c43d4d;
}

@media (max-width: 1050px) {
  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-credit-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .console-sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

  .console-brand {
    min-height: 66px;
  }

  .console-page .tabs.console-nav {
    flex: none;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 12px;
  }

  .console-page .tab-btn {
    width: auto;
    flex: none;
  }

  .console-sidebar-footer {
    display: none;
  }

  .console-stage {
    margin-left: 0;
  }

  .console-topbar {
    position: static;
    padding: 13px 18px;
  }

  .console-page .shell.console-content {
    padding: 18px;
  }

  .login-console-layout {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: 230px;
    padding: 30px;
  }

  .login-brand-panel h1 {
    font-size: 36px;
  }
}

@media (max-width: 650px) {
  .console-account > div {
    display: none;
  }

  .dashboard-metrics,
  .dashboard-grid,
  .dashboard-credit-stats {
    grid-template-columns: 1fr;
  }

  .login-form-stage {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  .studio-page .workspace-rail {
    position: static;
    width: 100%;
    height: auto;
  }

  .studio-page .rail-nav {
    flex-direction: row;
  }

  .studio-page .rail-footer,
  .studio-page .rail-section-label {
    display: none;
  }

  .studio-page .shell {
    width: calc(100vw - 28px);
    margin: 18px auto 32px;
  }
}
