:root {
  --bg: #0b0d0f;
  --panel: #121518;
  --panel-2: #171a1e;
  --panel-3: #1d2227;
  --line: #2a3036;
  --line-soft: #20252a;
  --text: #e6e9ed;
  --muted: #9aa3ad;
  --muted-2: #6f7882;
  --brand: #d6dce3;
  --accent: #8ea0b4;
  --ok: #5fb878;
  --warn: #d7a94b;
  --danger: #d96b6b;
  --info: #6ea8d7;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 13rem;
  --topbar-h: 60px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon.tiny {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.mobile-only {
  display: none !important;
}

.auth-root {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0b0d0f;
}

.auth-shell {
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 50px var(--shadow);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-brand .brand-mark,
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  border: 1px solid #3a4149;
  background: #20252a;
  color: var(--brand);
  font-weight: 800;
  letter-spacing: 0;
}

.auth-title {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0;
}

.auth-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  background: #0e1114;
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.auth-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  cursor: pointer;
}

.auth-tabs button.is-active {
  color: var(--text);
  background: var(--panel-3);
}

.console {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  height: calc(100vh - var(--topbar-h));
  position: sticky;
  top: var(--topbar-h);
  display: flex;
  flex-direction: column;
  border-right: 0;
  background: var(--bg);
  z-index: 20;
}

.sidebar-mobile-head {
  display: none;
  min-height: var(--topbar-h);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.nav {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.nav-section {
  margin: 0 0 4px;
  padding: 4px 0;
}

.nav-section:first-child {
  margin-top: 0;
}

.mobile-top-nav {
  display: none;
}

.nav-label {
  min-height: 32px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 8px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 7px 8px 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: #171b1f;
  color: var(--text);
  outline: none;
}

.nav-item.is-active {
  background: transparent;
  color: var(--text);
  font-weight: 650;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 1px;
  background: var(--brand);
}

.nav-item.is-active:hover,
.nav-item.is-active:focus-visible {
  background: transparent;
}

.nav-item .nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator {
  display: grid;
  grid-template-columns: 32px minmax(88px, 1fr) 34px;
  gap: 8px;
  align-items: center;
  padding: 3px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  border: 1px solid #394049;
  background: #20252a;
  color: var(--text);
  font-weight: 700;
}

.operator-copy {
  min-width: 0;
  max-width: 180px;
}

.operator-copy strong,
.operator-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-copy small {
  color: var(--muted);
  font-size: 11px;
}

.main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  padding: 12px 14px 18px;
}

.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 0;
  background: rgba(11, 13, 15, 0.98);
  backdrop-filter: blur(12px);
}

.section-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
  display: none;
}

.section-nav-item {
  position: relative;
  min-height: 32px;
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.section-nav-item:hover,
.section-nav-item:focus-visible {
  background: #171b1f;
  color: var(--text);
  outline: none;
}

.section-nav-item.is-active {
  background: transparent;
  color: var(--text);
}

.section-nav-item.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 1px;
  background: var(--brand);
}

.section-nav-item.is-active:hover,
.section-nav-item.is-active:focus-visible {
  background: transparent;
}

.section-nav-item[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
}

.service-state {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101316;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 5px;
  background: var(--muted-2);
}

.status-dot.ok {
  background: var(--ok);
}

.status-dot.danger {
  background: var(--danger);
}

.service-copy {
  display: grid;
  line-height: 1.15;
}

.service-copy strong {
  font-size: 12px;
}

.service-copy small {
  color: var(--muted-2);
  font-size: 10px;
  margin-top: 2px;
}

.noscript {
  margin: 24px;
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: #171214;
  color: #ffd2d2;
}

.page {
  width: 100%;
  min-height: calc(100vh - var(--topbar-h) - 30px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1215;
}

.stack {
  display: grid;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.page-intro-block {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.page-intro {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
}

.page-intro h2 {
  margin: 0 0 2px;
  font-size: 14px;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.page-filter-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.page-search-field {
  width: min(100%, 320px);
  min-width: 240px;
  flex: 0 1 320px;
  margin-left: auto;
}

.page-search-input,
.page-filter-select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0d1013;
  color: var(--text);
  outline: none;
}

.page-search-input {
  width: 100%;
  padding: 7px 10px;
}

.page-search-input::placeholder {
  color: var(--muted-2);
}

.page-filter-select {
  min-width: 148px;
  padding: 6px 30px 6px 10px;
}

.page-search-input:focus,
.page-filter-select:focus {
  border-color: #4b5561;
}

.page-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.page-filter-actions .btn {
  min-height: 36px;
}

.nav-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  stroke-width: 1.9;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel,
.card,
.table-wrap,
.settings-form,
.state-panel,
.form-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.page .panel,
.page .card,
.page .table-wrap,
.page .settings-form,
.page .state-panel,
.page .form-panel,
.page .metric-card,
.page .session-card,
.page .session-quota-grid > div,
.page .sub-card {
  border: 0;
}

.panel {
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.panel-title h2,
.panel-title h3 {
  margin: 0;
  font-size: 15px;
}

.panel-title small,
.muted {
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #12161a;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 9px;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: 0;
}

.metric-note {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.grid-3,
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.card {
  padding: 15px;
  min-width: 0;
}

.card[role="button"] {
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.card[role="button"]:hover,
.card[role="button"]:focus-visible {
  background: #171b1f;
  box-shadow: inset 2px 0 0 #727d88;
  outline: none;
}

.card.compact {
  padding: 12px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title {
  margin: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.card-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.model-limit-list {
  display: grid;
  margin-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.model-limit-list > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(88px, 0.7fr) minmax(0, 1.8fr);
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.model-limit-list strong,
.model-limit-list span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.model-limit-list span {
  color: var(--muted);
}

.plugin-card-summary {
  display: grid;
  grid-template-columns: minmax(90px, 0.65fr) minmax(0, 1.65fr) minmax(110px, 0.8fr);
  gap: 12px;
  margin-top: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.plugin-card-summary small,
.plugin-card-summary strong {
  display: block;
}

.plugin-card-summary small,
.module-kicker,
.plugin-module-copy small {
  color: var(--muted-2);
  font-size: 11px;
}

.plugin-card-summary strong {
  margin-top: 3px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.account-platform-list {
  display: grid;
  margin-top: 4px;
  border-top: 1px solid var(--line-soft);
}

.account-platform-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.account-platform-row > div,
.account-platform-row strong,
.account-platform-row small {
  display: block;
  min-width: 0;
}

.account-platform-row small,
.account-quota,
.session-login-state,
.session-facts,
.pool-stat-grid small {
  color: var(--muted);
  font-size: 12px;
}

.account-quota {
  grid-column: 1 / -1;
}

.pool-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.pool-stat-grid > div {
  min-width: 0;
}

.pool-stat-grid small,
.pool-stat-grid strong {
  display: block;
}

.pool-stat-grid strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.platform-session-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.session-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1215;
}

.session-login-state {
  margin: 8px 0;
}

.session-quota-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.session-quota-grid > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #12161a;
}

.session-quota-grid small,
.session-quota-grid strong,
.session-facts span {
  display: block;
}

.session-quota-grid strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.session-facts {
  display: grid;
  gap: 3px;
  margin-top: 9px;
}

.account-error {
  margin: 9px 0 0;
  color: #ffc3c3;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sub-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  margin-top: 10px;
}

.sub-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #0f1215;
  padding: 9px;
}

.sub-card strong,
.sub-card span {
  display: block;
}

.sub-card span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.artifact-card {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.artifact-card:hover,
.artifact-card:focus-visible {
  border-color: #4b5561;
  background: #14181c;
  outline: none;
}

.artifact-card > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-card-actions,
.artifact-preview-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.artifact-card-actions {
  margin-top: 10px;
}

.artifact-card-actions .btn {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.artifact-preview {
  display: grid;
  gap: 12px;
}

.artifact-preview-heading {
  min-width: 0;
}

.artifact-preview-heading strong,
.artifact-preview-heading span {
  display: block;
}

.artifact-preview-heading strong {
  overflow-wrap: anywhere;
}

.artifact-preview-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.artifact-preview-stage {
  width: 100%;
  height: min(56vh, 520px);
  min-height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #090b0d;
}

.artifact-preview-stage.is-audio,
.artifact-preview-stage.is-document,
.artifact-preview-stage.is-empty {
  height: 180px;
  min-height: 180px;
}

.artifact-preview-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #090b0d;
}

.artifact-preview-audio {
  width: min(100% - 32px, 620px);
}

.artifact-file-fallback {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.artifact-file-fallback .icon {
  width: 28px;
  height: 28px;
}

.artifact-file-fallback strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.artifact-file-fallback span {
  font-size: 12px;
}

.artifact-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.artifact-switch-button {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #0f1215;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.artifact-switch-button:hover,
.artifact-switch-button:focus-visible,
.artifact-switch-button.is-active {
  border-color: #4b5561;
  background: #171b1f;
  outline: none;
}

.artifact-switch-button strong,
.artifact-switch-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-switch-button span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.plugin-module-card {
  display: grid;
  align-content: start;
  gap: 11px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.plugin-module-card:hover,
.plugin-module-card:focus-visible,
.plugin-module-card.is-expanded {
  border-color: #4b5561;
  background: #14181c;
  outline: none;
}

.plugin-module-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plugin-module-head > div {
  min-width: 0;
}

.plugin-module-head strong {
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.plugin-module-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.plugin-module-chevron {
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  transition: transform 0.15s ease;
}

.plugin-module-card.is-expanded .plugin-module-chevron {
  transform: rotate(180deg);
}

.plugin-module-copy {
  min-width: 0;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}

.plugin-module-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.plugin-module-detail {
  display: grid;
  gap: 10px;
  padding-top: 1px;
}

.plugin-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.plugin-config-grid > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #0d1013;
}

.plugin-config-grid small,
.plugin-config-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.plugin-config-grid small {
  color: var(--muted-2);
  font-size: 11px;
}

.plugin-config-grid strong {
  margin-top: 3px;
  font-size: 12px;
}

.plugin-config-empty {
  margin: 0;
  color: var(--muted-2);
  font-size: 12px;
}

.table-wrap {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.usage-log-table table {
  min-width: 1250px;
}

.token-table table {
  min-width: 1080px;
}

.token-table th,
.token-table td {
  padding: 11px 12px;
}

.token-table td {
  vertical-align: top;
}

.token-table th:nth-child(1) {
  min-width: 168px;
}

.token-table th:nth-child(2) {
  min-width: 250px;
}

.token-table th:nth-child(3) {
  min-width: 150px;
}

.token-table th:nth-child(4) {
  min-width: 190px;
}

.token-table th:nth-child(7) {
  min-width: 250px;
}

.token-key-cell {
  display: grid;
  gap: 7px;
  min-width: 315px;
}

.token-key-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.token-key-value {
  display: inline-block;
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

.token-eye-button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-color: var(--line-soft);
  background: #111417;
}

.token-eye-button .icon {
  width: 15px;
  height: 15px;
}

.token-key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.token-key-actions .btn {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.token-balance-stack {
  display: grid;
  gap: 3px;
  min-width: 175px;
}

.token-quota-stack {
  display: grid;
  gap: 3px;
  min-width: 175px;
}

.token-balance-stack > strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.token-balance-stack > strong.is-exhausted {
  color: #e59a9a;
}

.token-quota-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.token-quota-line span,
.token-quota-stack > small {
  color: var(--muted);
  font-size: 11px;
}

.token-quota-line strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.token-quota-line.is-exhausted strong {
  color: #e59a9a;
}

.token-quota-stack .table-subline {
  max-width: 205px;
  margin-top: 2px;
}

.token-row-actions {
  justify-content: flex-start;
  min-width: 236px;
}

.table-actions-cell {
  min-width: 250px;
}

.table-subline {
  display: block;
  max-width: 180px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-count-button {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.artifact-count-button .icon {
  width: 14px;
  height: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  background: #101316;
  white-space: nowrap;
}

td {
  color: #d7dce2;
}

tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.code-cell,
.code-block,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.code-cell {
  color: #d4d9df;
  background: #0d1013;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  word-break: break-all;
}

.code-block {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow: auto;
  background: #0d1013;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  color: #dbe0e6;
  font-size: 12px;
}

.api-doc-layout {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.api-doc-toc {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 2px 14px 2px 0;
  border-right: 1px solid var(--line-soft);
}

.api-doc-toc > strong {
  padding: 6px 8px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.api-doc-toc-item {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.api-doc-toc-item span:first-child {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.api-doc-toc-item:hover,
.api-doc-toc-item:focus-visible {
  background: #171b1f;
  color: var(--text);
  outline: none;
}

.api-doc-content {
  min-width: 0;
}

.api-doc-section {
  min-width: 0;
  scroll-margin-top: calc(var(--topbar-h) + 18px);
  padding: 0 0 28px;
  margin: 0 0 28px;
  border-bottom: 1px solid var(--line-soft);
}

.api-doc-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.api-doc-section-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 16px;
}

.api-doc-section-head h3 {
  margin: 0;
  font-size: 17px;
}

.api-doc-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.api-doc-index {
  min-height: 25px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.api-doc-body {
  min-width: 0;
  display: grid;
  gap: 13px;
  padding-left: 44px;
}

.api-doc-body > p {
  margin: 0;
  color: var(--muted);
}

.api-fact-grid,
.api-prefix-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.api-fact-grid > div,
.api-prefix-grid > div {
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.api-fact-grid small,
.api-fact-grid code,
.api-prefix-grid code,
.api-prefix-grid span {
  display: block;
}

.api-fact-grid small,
.api-prefix-grid span {
  color: var(--muted);
  font-size: 12px;
}

.api-fact-grid code,
.api-prefix-grid code {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.api-endpoint {
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(180px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.api-endpoint > code {
  overflow-wrap: anywhere;
  color: #dce2e8;
}

.api-endpoint > span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.api-method {
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: #c8e5fb;
  background: rgba(110, 168, 215, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 750;
}

.api-method.post {
  color: #b9e8c4;
  background: rgba(95, 184, 120, 0.08);
}

.api-code {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #0d1013;
}

.api-code-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 7px 5px 12px;
  color: var(--muted);
  font-size: 12px;
}

.api-copy-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.api-code .code-block {
  max-height: 460px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  white-space: pre;
}

.api-field-grid {
  display: grid;
  border-top: 1px solid var(--line-soft);
}

.api-field-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(110px, 0.6fr) minmax(240px, 2fr);
  gap: 12px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.api-field-row code,
.api-field-row p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.api-field-row p,
.api-field-type {
  color: var(--muted);
  font-size: 12px;
}

.api-note {
  padding: 10px 12px;
  border-left: 2px solid var(--info);
  background: rgba(110, 168, 215, 0.06);
}

.api-note.warn {
  border-left-color: var(--warn);
  background: rgba(215, 169, 75, 0.06);
}

.api-note.ok {
  border-left-color: var(--ok);
  background: rgba(95, 184, 120, 0.06);
}

.api-note strong {
  font-size: 12px;
}

.api-note p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.api-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.api-flow span {
  color: #dce2e8;
  font-size: 12px;
}

.api-flow b {
  color: var(--muted-2);
  font-weight: 400;
}

.btn,
.icon-button {
  border: 1px solid var(--line);
  background: #171b1f;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn {
  padding: 8px 12px;
  font-weight: 650;
}

.btn:hover,
.icon-button:hover,
.btn:focus-visible,
.icon-button:focus-visible {
  background: #20252a;
  border-color: #3a424b;
  outline: none;
}

.btn.primary {
  background: #d7dde4;
  color: #0d1013;
  border-color: #d7dde4;
}

.btn.primary:hover,
.btn.primary:focus-visible {
  background: #c7cfd8;
  border-color: #c7cfd8;
}

.btn.danger {
  color: #ffd8d8;
  border-color: rgba(217, 107, 107, 0.45);
  background: rgba(217, 107, 107, 0.11);
}

.btn.ghost {
  background: transparent;
}

.btn[disabled],
.icon-button[disabled] {
  cursor: not-allowed;
  opacity: 0.48;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
}

.kbd {
  border: 1px solid var(--line);
  border-bottom-color: #3a424b;
  background: #0f1215;
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.badge,
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: #111519;
  font-size: 12px;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 4px;
  background: var(--muted-2);
}

.status.ok {
  color: #b9e8c4;
  border-color: rgba(95, 184, 120, 0.4);
}

.status.ok::before {
  background: var(--ok);
}

.status.warn {
  color: #ffe2a3;
  border-color: rgba(215, 169, 75, 0.42);
}

.status.warn::before {
  background: var(--warn);
}

.status.danger {
  color: #ffc3c3;
  border-color: rgba(217, 107, 107, 0.42);
}

.status.danger::before {
  background: var(--danger);
}

.status.info {
  color: #c8e5fb;
  border-color: rgba(110, 168, 215, 0.42);
}

.status.info::before {
  background: var(--info);
}

.form-grid {
  display: grid;
  gap: 13px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-section,
.field.wide {
  grid-column: 1 / -1;
}

.form-section {
  display: grid;
  gap: 2px;
  padding: 5px 0 8px;
  border-bottom: 1px solid var(--line-soft);
}

.form-section:not(:first-child) {
  margin-top: 5px;
}

.form-section strong {
  font-size: 13px;
}

.form-section small {
  color: var(--muted-2);
  font-size: 11px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0e1114;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.field:has(input[type="checkbox"]) {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.field:has(input[type="checkbox"]) small {
  grid-column: 1 / -1;
}

.field textarea {
  resize: vertical;
  min-height: 86px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #4b5561;
}

.field small {
  color: var(--muted-2);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 16px;
}

.settings-form,
.form-panel {
  padding: 16px;
}

.settings-section {
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
  margin-top: 16px;
}

.settings-section:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.state-panel {
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.state-box {
  max-width: 560px;
}

.state-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #101316;
  margin-bottom: 12px;
}

.state-box h2,
.state-box h3 {
  margin: 0 0 6px;
}

.state-box p {
  color: var(--muted);
  margin: 0 0 14px;
}

.loader {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--muted);
  border-radius: 8px;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 13px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.66);
}

.modal {
  width: min(100%, 640px);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 80px var(--shadow);
}

.modal.wide {
  width: min(100%, 840px);
}

.modal-header,
.modal-footer {
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header {
  border-bottom: 1px solid var(--line-soft);
}

.modal-footer {
  border-top: 1px solid var(--line-soft);
  justify-content: flex-end;
}

.modal-title {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 16px;
  overflow: auto;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14181c;
  box-shadow: 0 16px 40px var(--shadow);
  padding: 11px 12px;
  color: var(--text);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
}

.toast p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.toast strong {
  display: block;
  font-size: 13px;
}

.toast.ok .icon { color: var(--ok); }
.toast.warn .icon { color: var(--warn); }
.toast.danger .icon { color: var(--danger); }
.toast.info .icon { color: var(--info); }

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.timeline-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.timeline-time {
  color: var(--muted-2);
  font-size: 12px;
}

.progress {
  width: 100%;
  height: 8px;
  border-radius: 5px;
  border: 1px solid var(--line-soft);
  background: #0d1013;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  max-width: 100%;
  background: #8795a6;
}

.usage-status-cell {
  display: grid;
  gap: 7px;
  min-width: 116px;
}

.usage-progress-line {
  display: grid;
  grid-template-columns: minmax(56px, 76px) 34px;
  align-items: center;
  gap: 7px;
}

.usage-progress-line .progress {
  height: 6px;
}

.usage-progress-line small {
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1;
}

.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101316;
  padding: 12px;
  color: var(--muted);
}

.notice.warn {
  color: #ffe2a3;
  border-color: rgba(215, 169, 75, 0.42);
  background: rgba(215, 169, 75, 0.08);
}

.split-list {
  display: grid;
  gap: 10px;
}

.split-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.split-row:last-child {
  border-bottom: 0;
}

.split-row strong {
  overflow-wrap: anywhere;
}

.nav-scrim {
  display: none;
}

@media (max-width: 1120px) {
  .metric-grid,
  .grid-3,
  .card-grid,
  .platform-session-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .console {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    width: min(86vw, var(--sidebar-w));
    transform: translateX(-105%);
    transition: transform 0.18s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-mobile-head {
    display: flex;
  }

  .mobile-top-nav {
    display: block;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 15;
    border: 0;
    background: rgba(0, 0, 0, 0.58);
    cursor: pointer;
  }

  body.nav-open .nav-scrim {
    display: block;
  }

  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    padding: 10px 14px;
    align-items: center;
  }

  .section-nav {
    display: none;
  }

  .topbar-actions {
    flex: 1;
    gap: 8px;
  }

  .main {
    grid-column: 1;
    grid-row: 2;
    padding: 10px;
  }

  .page {
    min-height: calc(100vh - var(--topbar-h) - 20px);
    padding: 12px;
  }

  .page-intro {
    display: grid;
  }

  .page-search-field {
    width: 100%;
    flex: 1 1 100%;
    margin-left: 0;
  }

  .page-filter-select {
    flex: 1 1 180px;
  }

  .api-doc-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .api-doc-toc {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .api-doc-toc > strong {
    grid-column: 1 / -1;
  }

  .api-doc-body {
    padding-left: 0;
  }

  .metric-grid,
    .grid-3,
    .card-grid,
    .platform-session-grid,
    .sub-card-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }
}

@media (max-width: 540px) {
  .auth-shell {
    padding: 20px;
  }

  .topbar-actions {
    min-width: 0;
  }

  .service-copy {
    display: none;
  }

  .service-state {
    min-width: 38px;
    justify-content: center;
    padding: 0;
  }

  .operator {
    grid-template-columns: 32px 34px;
  }

  .operator-copy {
    display: none;
  }

  .page-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .page-search-field,
  .page-filter-select {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .page-filter-actions {
    justify-content: flex-end;
  }

  .plugin-card-summary {
    grid-template-columns: 1fr;
  }

  .plugin-config-grid {
    grid-template-columns: 1fr;
  }

  .api-doc-toc,
  .api-fact-grid,
  .api-prefix-grid {
    grid-template-columns: 1fr;
  }

  .api-endpoint,
  .api-field-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .api-endpoint .api-method {
    width: 54px;
  }

  .api-code .code-block {
    font-size: 11px;
  }

  .metric-value {
    font-size: 22px;
  }

  .modal-backdrop {
    padding: 12px;
    align-items: start;
  }

  .modal {
    margin-top: 22px;
    max-height: calc(100vh - 44px);
  }

  .toast-root {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
