:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #0f0f10;
  --surface-2: #171719;
  --surface-3: #202124;
  --field-bg: #0a0a0a;
  --field-bg-hover: #0a0a0a;
  --field-bg-focus: #0a0a0a;
  --field-border: #27272a;
  --field-border-hover: #27272a;
  --field-border-focus: #4a4a53;
  --field-shadow: none;
  --field-focus-ring: 0 0 0 1px rgba(237, 237, 237, 0.06);
  --text: #ededed;
  --muted: #a3a3a3;
  --muted-2: #737373;
  --line: #27272a;
  --line-strong: #3f3f46;
  --accent: #ededed;
  --accent-strong: #ffffff;
  --cta: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --pill-good-fg: #9ae6c7;
  --pill-good-bg: #102118;
  --pill-good-border: #244535;
  --pill-warn-fg: #e8c97a;
  --pill-warn-bg: #211d13;
  --pill-warn-border: #4b4022;
  --pill-bad-fg: #efb0b0;
  --pill-bad-bg: #241516;
  --pill-bad-border: #543033;
  --pill-muted-fg: #c7ccd4;
  --pill-muted-bg: #17181b;
  --pill-muted-border: #30333a;
  --shadow: none;
  --radius: 6px;
  --font-xs: 11px;
  --font-badge: 10px;
  --font-sm: 12px;
  --font-md: 13px;
  --font-lg: 14px;
  --font-2xl: 22px;
  --font-display: 24px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 650;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: "Fira Sans", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-md);
  line-height: 1.45;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 24px;
  border-bottom: 1px solid #27272a33;
  background: #0a0a0a;
}

.brand {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 210px;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 3px;
}

.brand-mark {
  width: 54px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.brand-mark svg {
  width: 54px;
  height: 40px;
  fill: none;
  overflow: visible;
}

.brand-mark-primary {
  stroke: #f4f4f5;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark-secondary {
  stroke: #a1a1aa;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark-letter-primary,
.brand-mark-letter-secondary {
  font-family: "Fira Sans", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0;
  stroke: none;
}

.brand-mark-letter-primary {
  fill: #f4f4f5;
}

.brand-mark-letter-secondary {
  fill: #a1a1aa;
}

.brand-mark-accent-stroke {
  stroke: #34d399;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-title {
  font-size: var(--font-lg);
  font-weight: var(--weight-semibold);
}

.brand-subtitle {
  color: var(--muted);
  font-size: var(--font-xs);
}

.topnav,
.action-row,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topnav {
  justify-content: flex-end;
}

.price-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr)) auto auto;
  gap: 8px;
  align-items: end;
  min-width: 460px;
}

.price-field {
  display: grid;
  gap: 4px;
}

.price-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.price-form input {
  min-height: 34px;
  width: 100%;
}

.price-form textarea {
  min-height: 58px;
  resize: vertical;
  width: 100%;
}

.pricing-settings-dialog {
  width: min(860px, calc(100vw - 32px));
}

.pricing-grid {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.pricing-grid-head,
.pricing-grid-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.9fr) minmax(54px, 0.55fr) repeat(3, minmax(78px, 1fr));
  gap: 6px;
  align-items: center;
}

.pricing-grid-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pricing-grid-row input {
  min-height: 32px;
  width: 100%;
}

.price-form button {
  min-height: 34px;
  white-space: nowrap;
}

.model-editor {
  display: grid;
  gap: 14px;
}

.model-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.model-group-field {
  display: grid;
  gap: 8px;
}

.model-group-field > span {
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}

.model-groups-form {
  position: relative;
}

.field-label {
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.model-group-popover {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.model-group-popover summary {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
}

.model-group-popover summary::-webkit-details-marker {
  display: none;
}

.model-group-popover summary strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: var(--font-sm);
}

.model-group-popover[open] summary {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.model-group-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: min(280px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.table-popover .model-group-panel {
  right: 0;
  left: auto;
}

.model-group-panel-actions {
  display: flex;
  gap: 8px;
}

.price-form-v2 {
  display: grid;
  gap: 10px;
  width: 100%;
}

.model-pricing-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 160px;
  white-space: nowrap;
  line-height: 20px;
}

.model-config-row td {
  padding-top: 0;
  background: color-mix(in srgb, var(--surface) 88%, black);
}

.model-config-details {
  display: block;
}

.model-config-details summary {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  list-style: none;
}

.model-config-details summary::-webkit-details-marker {
  display: none;
}

.model-config-details summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.model-config-details summary:hover,
.model-config-details summary:focus-visible {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.model-config-details[open] summary {
  margin-bottom: 12px;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.model-config-details[open] summary::before {
  transform: rotate(45deg);
}

.pricing-editor {
  display: grid;
  gap: 10px;
}

.billing-mode-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.billing-mode-group label {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.billing-mode-group input {
  width: auto;
  min-height: 0;
}

.pricing-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 8px;
}

.pricing-editor[data-pricing-mode="request"] .pricing-editor-grid {
  grid-template-columns: minmax(160px, 220px);
}

.tier-editor {
  display: grid;
  gap: 6px;
}

.tier-editor-head,
.tier-editor-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(112px, 1fr) repeat(3, minmax(90px, 1fr)) minmax(72px, auto);
  gap: 6px;
  align-items: center;
}

.tier-editor-head {
  color: var(--muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
}

.tier-editor-row input,
.pricing-editor-grid input {
  min-height: 32px;
}

.tier-add-button {
  width: fit-content;
  min-height: 32px;
}

.model-create-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tier-delete-button {
  min-height: 32px;
}

.pricing-expression {
  display: block;
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: var(--font-xs);
}

.logout-form,
.user-menu {
  margin: 0;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
  cursor: pointer;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
}

.user-menu[open] summary {
  color: var(--text);
  background: var(--surface-2);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 128px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.user-menu-panel a,
.user-menu-panel button {
  width: 100%;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  border-color: transparent;
  color: var(--text);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: var(--font-sm);
}

.user-menu-panel a:hover,
.user-menu-panel a:focus-visible,
.user-menu-panel button:hover,
.user-menu-panel button:focus-visible {
  background: var(--surface-2);
  border-color: var(--line);
}

.nav-link,
.button-link,
button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  font: inherit;
  font-size: var(--font-md);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.resource-card .button-link,
.resource-card button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: var(--font-sm);
}

.nav-link {
  color: var(--muted);
}

.nav-link.active,
.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-badge {
  width: 18px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #050506;
  font-family: Arial, sans-serif;
  font-size: 11px;
  line-height: 18px;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  text-align: center;
  transform: translateY(-0.5px);
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px 24px 32px;
  display: grid;
  gap: 16px;
}

.auth-panel {
  min-height: min(560px, calc(100vh - 160px));
  display: grid;
  place-items: center;
}

.auth-panel.login-screen {
  min-height: calc(100vh - 58px);
  margin: -22px -24px -32px;
  padding: 48px max(24px, calc((100vw - 1440px) / 2 + 24px)) 64px;
  background: var(--bg);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 42px;
}

.password-toggle-button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  color: #8a8a92;
  background: transparent;
  border-color: transparent;
}

.password-toggle-button:hover,
.password-toggle-button:focus-visible {
  color: #b6b6bd;
  background: transparent;
  border-color: transparent;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 0 6px;
}

.hero.compact {
  align-items: center;
}

.hero h1 {
  margin: 0;
  font-size: var(--font-display);
  line-height: 1.15;
  letter-spacing: 0;
  font-weight: var(--weight-semibold);
}

.hero p {
  margin: 7px 0 0;
  max-width: 76ch;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.group-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  margin: -6px 0 12px;
  border-bottom: 1px solid var(--line);
}

.group-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 24px;
  overflow-x: auto;
}

.group-tab {
  box-sizing: border-box;
  flex: 0 0 auto;
  height: 24px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  color: var(--muted);
  font-size: var(--font-sm);
  line-height: 1;
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
}

.group-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.group-tab.active {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface);
}

.group-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding-bottom: 4px;
  white-space: nowrap;
}

.group-summary .panel-note {
  line-height: 28px;
}

.group-summary button:not(.icon-button) {
  height: 28px;
  min-height: 0;
  padding: 0 10px;
  font-size: var(--font-sm);
  line-height: 1;
}

.status-strip,
.metric-grid,
.card-grid,
.provider-grid {
  display: grid;
  gap: 10px;
}

.status-strip {
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(140px, 0.8fr));
}

.metric-grid {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

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

.grid-two > .panel .card-grid {
  grid-template-columns: 1fr;
}

.provider-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.panel,
.metric,
.resource-card,
.provider-card,
.status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  padding: 16px;
}

.panel.narrow {
  width: min(860px, 100%);
}

.auth-card {
  width: min(420px, calc(100vw - 48px));
  max-width: 420px;
  padding: 18px;
  border-color: var(--line);
  background: rgba(15, 15, 16, 0.88);
  backdrop-filter: blur(14px);
}

.auth-card .panel-head {
  margin-bottom: 14px;
}

.auth-card .form-actions button {
  width: 100%;
}

.auth-card .auth-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.auth-card .auth-actions .button-link {
  width: 100%;
  justify-content: center;
}

.panel.wide {
  width: min(1100px, 100%);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 0;
}

.panel-head h2,
.resource-card h3,
.provider-card h3 {
  margin: 0;
  font-size: var(--font-lg);
  line-height: 1.2;
  font-weight: var(--weight-semibold);
}

.panel-head .cell-stack {
  min-width: 0;
}

.panel-note,
.muted,
.empty,
.field-note {
  color: var(--muted);
}

.panel-note,
.field-note {
  font-size: var(--font-sm);
}

.status-card {
  padding: 14px;
  display: grid;
  gap: 8px;
  background: #101012;
}

.status-card.primary {
  border-color: var(--line);
}

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

.status-title strong {
  font-size: var(--font-lg);
  font-weight: var(--weight-semibold);
}

.metric {
  padding: 12px;
  min-height: 82px;
  display: grid;
  align-content: space-between;
  background: #101012;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: var(--font-sm);
  margin-bottom: 8px;
}

.metric strong {
  font-size: var(--font-2xl);
  line-height: 1;
  font-weight: var(--weight-semibold);
}

.metric small {
  color: var(--muted);
  font-size: var(--font-sm);
}

.user-model-panel .panel-head strong {
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

.user-model-table-wrap {
  border-color: var(--line);
}

.user-model-table th,
.user-model-table td {
  white-space: nowrap;
}

.user-model-table td:first-child {
  white-space: normal;
  min-width: 180px;
}

.usage-chart-panel .panel-head {
  align-items: flex-start;
  margin-bottom: 8px;
}

.usage-chart-panel .panel-head strong {
  font-size: var(--font-lg);
  font-weight: var(--weight-semibold);
}

.usage-chart {
  height: 148px;
  display: grid;
  grid-template-columns: repeat(24, minmax(10px, 1fr));
  align-items: end;
  gap: 5px;
  padding: 6px 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c0c0e;
}

.usage-chart-bar {
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: end;
}

.usage-chart-fill {
  width: 100%;
  display: block;
  border-radius: 3px 3px 1px 1px;
  background: #d4d4d8;
  opacity: 0.9;
}

.usage-chart-labels {
  display: grid;
  grid-template-columns: repeat(24, minmax(10px, 1fr));
  gap: 5px;
  padding: 0 10px;
  margin-top: 6px;
}

.usage-chart-label {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1;
  text-align: center;
}

.resource-card,
.provider-card {
  position: relative;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #101012;
}

.resource-card,
.provider-card,
.metric,
.status-card {
  box-shadow: none;
}

.resource-card:hover,
.provider-card:hover,
.data-table tbody tr:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 2px;
}

.resource-card .cell-stack {
  min-width: 0;
}

.resource-card h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 28px;
}

.account-details {
  position: relative;
  display: flex;
  align-items: center;
  height: 28px;
}

.account-details summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.account-details summary::-webkit-details-marker {
  display: none;
}

.account-details summary:hover,
.account-details summary:focus-visible {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.account-detail-panel {
  position: absolute;
  top: 36px;
  right: 0;
  z-index: 20;
  width: min(380px, calc(100vw - 48px));
  max-height: min(560px, calc(100vh - 160px));
  overflow: auto;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #101012;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.account-detail-panel .kv:first-child {
  border-top: 0;
}

.card-meta,
.kv-list,
.endpoint-list {
  display: grid;
  gap: 6px;
}

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

.card-meta .kv {
  min-width: 0;
}

.account-summary {
  display: grid;
  gap: 6px;
}

.account-summary .kv {
  min-width: 0;
}

.account-summary .kv span:last-child,
.account-summary .kv strong,
.account-detail-panel .kv span:last-child,
.account-detail-panel .kv strong,
.account-detail-panel .kv code {
  min-width: 0;
  max-width: 68%;
  overflow-wrap: anywhere;
  text-align: right;
}

.quota-progress {
  position: relative;
  isolation: isolate;
  padding-bottom: 16px;
}

.quota-progress::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  z-index: -1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.quota-progress::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 0;
  z-index: -1;
  width: var(--quota-progress, 0%);
  height: 4px;
  border-radius: 999px;
  background: #10b981;
}

.quota-progress[style*="100"]::after {
  background: #ef4444;
}

.kv,
.endpoint-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 8px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.kv span:first-child,
.endpoint-item code:first-child {
  color: var(--muted);
}

.kv strong {
  font-weight: var(--weight-regular);
}

.copy-secret {
  width: min(220px, 58vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.copy-secret code {
  min-width: 0;
  justify-self: end;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.grid-two > .panel {
  min-width: 0;
}

.system-settings-page {
  display: grid;
  gap: 16px;
}

.settings-tab-layout {
  display: grid;
  grid-template-columns: minmax(160px, 210px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-tabs {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.settings-tabs a {
  display: block;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.settings-tabs a:hover,
.settings-tabs a:focus-visible {
  color: var(--text);
  background: #141416;
  outline: none;
}

.settings-tabs a.is-active {
  color: var(--text);
  border-color: #3f3f46;
  background: #171719;
}

.settings-tab-content {
  min-width: 0;
}

.settings-tab-content > .panel {
  margin: 0;
}

.system-notice {
  display: none;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101012;
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

.system-notice.tone-good {
  color: var(--pill-good-fg);
  border-color: var(--pill-good-border);
  background: var(--pill-good-bg);
}

.system-notice.tone-bad {
  color: var(--pill-bad-fg);
  border-color: var(--pill-bad-border);
  background: var(--pill-bad-bg);
}

.notice {
  display: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-2);
}

.notice.error {
  color: var(--pill-bad-fg);
  border-color: var(--pill-bad-border);
  background: var(--pill-bad-bg);
}

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

.grid-form.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.payment-provider-settings {
  row-gap: 12px;
}

.payment-settings-divider {
  height: 1px;
  margin: 50px 0;
  background: var(--line);
}

.full-span {
  grid-column: 1 / -1;
}

.stack-form,
.filter-grid {
  display: grid;
  gap: 12px;
}

.filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

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

.form-actions {
  padding-top: 4px;
}

.oauth-panel {
  justify-self: start;
}

.oauth-import-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.oauth-code {
  display: block;
  width: 100%;
  padding: 16px 56px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0a0a;
  color: var(--text);
  font-size: var(--font-2xl);
  line-height: 1.1;
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  text-align: center;
}

.oauth-code-wrap {
  position: relative;
  display: block;
}

.icon-button.oauth-code-copy {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
}

label {
  display: grid;
  gap: 6px;
}

.disclosure-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.disclosure-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

.disclosure-panel summary::-webkit-details-marker {
  display: none;
}

.disclosure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 0 12px 12px;
}

label span,
.form-label {
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background-color: var(--field-bg);
  color: var(--text);
  font: inherit;
  outline: none;
  box-shadow: var(--field-shadow);
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

select {
  padding-right: 34px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--field-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23a3a3a3' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
}

select option {
  background-color: var(--surface-2);
  color: var(--text);
}

select option:checked,
select option:hover,
select option:focus {
  background-color: var(--surface-3);
  color: var(--text);
}

select.select-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.select-shell {
  position: relative;
}

.select-shell.is-open {
  z-index: 30;
}

.select-trigger {
  width: 100%;
  min-height: 38px;
  padding: 8px 34px 8px 10px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background-color: var(--field-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  box-shadow: var(--field-shadow);
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
  position: relative;
}

.select-trigger::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 10px;
  height: 6px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23a3a3a3' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 10px 6px;
  transition: transform 120ms ease;
}

.select-shell.is-open .select-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.select-trigger:hover {
  border-color: var(--field-border-hover);
  background-color: var(--field-bg-hover);
}

.select-trigger:focus-visible {
  border-color: var(--field-border-focus);
  background-color: var(--field-bg-focus);
  box-shadow: var(--field-focus-ring);
}

.select-trigger-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  max-height: 240px;
  overflow-y: auto;
}

.select-menu[hidden] {
  display: none;
}

.select-option {
  width: 100%;
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: var(--weight-medium);
  text-align: left;
  justify-content: flex-start;
}

.select-option:hover,
.select-option.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.select-option[aria-selected="true"] {
  background: transparent;
  color: var(--text);
}

.select-option[aria-selected="true"]:hover,
.select-option[aria-selected="true"]:focus-visible {
  background: var(--surface-3);
  color: var(--text);
}

.select-option[disabled] {
  color: var(--muted-2);
  cursor: not-allowed;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--field-border-hover);
  background-color: var(--field-bg-hover);
}

textarea {
  resize: vertical;
  min-height: 132px;
  font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: var(--font-sm);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--field-border-focus);
  background-color: var(--field-bg-focus);
  box-shadow: var(--field-focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button,
.primary-link {
  background: #18181b;
  color: var(--text);
  border-color: #3f3f46;
}

button:hover,
.primary-link:hover {
  background: #27272a;
  border-color: #52525b;
}

button.ghost,
.ghost-link {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

button.ghost:hover,
.ghost-link:hover {
  border-color: var(--line-strong);
  background: #18181b;
}

button.danger,
.danger-link {
  background: transparent;
  border-color: #7f1d1d;
  color: var(--bad);
}

button.danger:hover,
.danger-link:hover {
  background: #1f1111;
}

.icon-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 5px;
}

.icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.copy-secret-button {
  justify-self: end;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.icon-button.copy-secret-button svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke-width: 1.85;
}

.icon-button.copy-secret-button:hover,
.icon-button.copy-secret-button:focus-visible {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.icon-button.copy-secret-button.is-copied {
  color: var(--cta);
  background: var(--pill-good-bg);
  border-color: var(--pill-good-border);
}

.group-settings-trigger {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.group-settings-trigger:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line-strong);
}

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

.checkbox-row input {
  width: 16px;
  min-height: 16px;
  flex: 0 0 auto;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.model-table-wrap {
  overflow: visible;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: var(--surface);
}

.grid-two .data-table {
  min-width: 100%;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.data-table thead th {
  color: var(--muted);
  background: var(--surface);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  border-top: none;
  border-bottom: 1px solid var(--line);
}

.audit-table {
  table-layout: fixed;
  min-width: 1160px;
}

.audit-col-kind {
  width: 66px;
}

.audit-col-status {
  width: 78px;
}

.audit-col-subject {
  width: 190px;
}

.audit-col-operation {
  width: 140px;
}

.audit-col-time {
  width: 126px;
}

.audit-table th,
.audit-table td {
  vertical-align: top;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1),
.audit-table th:nth-child(2),
.audit-table td:nth-child(2),
.audit-table th:nth-child(4),
.audit-table td:nth-child(4),
.audit-table th:nth-child(5),
.audit-table td:nth-child(5) {
  white-space: nowrap;
}

.audit-table td:nth-child(3) {
  overflow-wrap: anywhere;
}

.audit-operation-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: var(--font-badge);
  line-height: 1;
  font-weight: var(--weight-regular);
  letter-spacing: 0;
  white-space: nowrap;
  border: 1px solid var(--pill-border, var(--line-strong));
  background: var(--pill-bg, var(--surface-2));
  color: var(--pill-fg, var(--text));
  box-shadow: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.pill::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
  opacity: 0.8;
}

.tone-good {
  --pill-fg: var(--pill-good-fg);
  --pill-bg: var(--pill-good-bg);
  --pill-border: var(--pill-good-border);
}

.tone-warn {
  --pill-fg: var(--pill-warn-fg);
  --pill-bg: var(--pill-warn-bg);
  --pill-border: var(--pill-warn-border);
}

.tone-bad {
  --pill-fg: var(--pill-bad-fg);
  --pill-bg: var(--pill-bad-bg);
  --pill-border: var(--pill-bad-border);
}

.tone-muted {
  --pill-fg: var(--pill-muted-fg);
  --pill-bg: var(--pill-muted-bg);
  --pill-border: var(--pill-muted-border);
}

code {
  font-family: "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: var(--font-sm);
  overflow-wrap: anywhere;
}

.endpoint-item > *,
.kv > * {
  min-width: 0;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

body.confirm-open,
body.settings-open {
  overflow: hidden;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  align-items: center;
  justify-content: center;
  padding: 24px;
  display: none;
  background: rgba(5, 5, 6, 0.66);
  backdrop-filter: blur(6px);
}

.confirm-overlay.is-visible {
  display: flex;
}

.confirm-dialog {
  width: min(400px, 100%);
  border: 1px solid #3a2325;
  border-radius: 7px;
  background: #101012;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.5);
  padding: 16px 16px 14px;
  display: grid;
  gap: 12px;
}

.confirm-header {
  display: block;
}

.confirm-header-text {
  display: grid;
  gap: 4px;
}

.confirm-title {
  margin: 0;
  font-size: 15px;
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.confirm-caption {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-sm);
  line-height: 1.4;
}

.confirm-message {
  margin: 0;
  color: var(--text);
  font-size: var(--font-md);
  line-height: 1.55;
  padding: 10px 11px;
  border-radius: 6px;
  border: 1px solid #2a2a2f;
  background: #0c0c0e;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.prompt-dialog {
  border-color: var(--line-strong);
}

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

.prompt-input {
  width: 100%;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 5, 6, 0.64);
  backdrop-filter: blur(6px);
}

.settings-overlay.is-visible {
  display: flex;
}

.settings-dialog {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.48);
}

.password-overlay {
  z-index: 90;
  background: rgba(5, 5, 6, 0.58);
  backdrop-filter: blur(14px);
}

.password-dialog {
  width: min(420px, 100%);
}

.payment-dialog {
  width: min(520px, 100%);
}

.message-dialog {
  width: min(560px, 100%);
}

.message-list {
  display: grid;
  gap: 12px;
}

.message-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.message-item.unread {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.message-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.message-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message-title-row h2 {
  min-width: 0;
  margin: 0;
  font-size: var(--font-lg);
  line-height: 1.25;
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}

.message-body {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-meta {
  color: var(--muted);
  font-size: var(--font-sm);
}

.message-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.message-target-fields {
  display: grid;
  gap: 12px;
}

.message-target-panel {
  display: grid;
  gap: 8px;
}

.message-target-panel > span {
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

.message-target-options {
  max-height: 150px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
}

.message-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.settings-form .message-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  cursor: pointer;
}

.settings-form .message-choice:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.settings-form .message-choice input {
  width: 16px;
  min-height: 16px;
  flex: 0 0 auto;
}

.settings-form .message-choice span {
  color: var(--text);
  font-size: var(--font-sm);
  overflow-wrap: anywhere;
}

.message-user-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.message-user-picker input[type="search"]::-webkit-calendar-picker-indicator {
  display: none !important;
}

.message-selected-users {
  min-height: 34px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
}

.message-selected-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 4px 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--font-sm);
}

.message-selected-user button {
  min-width: 20px;
  width: 20px;
  min-height: 20px;
  height: 20px;
  padding: 0;
  border-radius: 4px;
  color: var(--muted);
}

[data-payment-create-fields] {
  display: grid;
  gap: 12px;
}

.payment-method-field {
  display: grid;
  gap: 8px;
}

.payment-method-field > span {
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: 650;
}

.payment-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 10px;
}

.payment-method-option {
  min-width: 0;
}

.payment-method-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.payment-method-card {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: var(--font-sm);
  font-weight: 650;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.payment-method-card:hover {
  border-color: #3f3f46;
  background: #101012;
}

.payment-method-option input:focus-visible + .payment-method-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.payment-method-option input:checked + .payment-method-card {
  border-color: #52525b;
  background: #141416;
  color: #fff;
}

.payment-brand-logo {
  display: block;
  width: auto;
  max-width: 82px;
  height: 28px;
  object-fit: contain;
}

.payment-brand-logo.wechat {
  max-width: 90px;
}

.payment-brand-logo.alipay {
  max-width: 86px;
}

.payment-result {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.payment-result .button-link {
  width: fit-content;
}

.payment-code {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.payment-code strong {
  color: var(--text);
  font-size: var(--font-lg);
  font-weight: 650;
}

.payment-code img {
  width: 240px;
  height: 240px;
  border: 10px solid #fff;
  border-radius: 6px;
  background: #fff;
}

.payment-qr img {
  width: 240px;
  height: 240px;
  border: 10px solid #fff;
  border-radius: 6px;
  background: #fff;
}

.payment-qr {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.payment-result code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

.user-details-dialog {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.user-details-list .kv:first-child {
  border-top: 0;
}

.user-details-list .kv code,
.user-details-list .kv strong,
.user-details-list .kv span:last-child {
  min-width: 0;
  max-width: 66%;
  overflow-wrap: anywhere;
  text-align: right;
}

.user-details-chart {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c0c0e;
}

.user-details-chart .panel-head {
  margin-bottom: 0;
}

.user-details-chart .panel-head h3,
.user-details-chart .panel-head strong {
  margin: 0;
  font-size: var(--font-md);
  line-height: 1.2;
  font-weight: var(--weight-semibold);
}

.user-details-chart .usage-chart {
  height: 112px;
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-header h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  font-weight: var(--weight-semibold);
}

.settings-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--font-sm);
}

.settings-close {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.settings-close:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

.settings-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c0c0e;
}

.settings-form label {
  display: grid;
  gap: 6px;
}

.settings-form label.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.settings-actions button {
  min-height: 32px;
  padding: 6px 11px;
  font-size: var(--font-sm);
}

.password-dialog .settings-actions button:focus-visible {
  outline: none;
  border-color: #52525b;
  box-shadow: 0 0 0 1px #3a3a40;
}

.password-dialog .settings-actions button.ghost:focus-visible {
  background: transparent;
}

.proxy-control {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  color: inherit;
  font: inherit;
}

.proxy-control input {
  min-width: 0;
  flex: 1 1 auto;
}

.proxy-test-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
  font-size: var(--font-xs);
  line-height: 1;
}

.proxy-test-result {
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: var(--font-xs);
  line-height: 1.45;
}

.proxy-test-result:empty {
  display: none;
}

.proxy-test-result.is-pending {
  color: var(--muted);
}

.proxy-test-result.is-ok {
  color: var(--pill-good-fg);
}

.proxy-test-result.is-error {
  color: var(--pill-bad-fg);
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 8px;
  pointer-events: none;
}

.toast-message {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 24px;
  align-items: start;
  gap: 10px;
  padding: 10px 8px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101012;
  color: var(--text);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.36);
  font-size: var(--font-sm);
  line-height: 1.45;
  opacity: 0;
  pointer-events: auto;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.toast-message::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.toast-message.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-message.is-leaving {
  opacity: 0;
  transform: translateY(6px);
}

.toast-ok {
  border-color: var(--pill-good-border);
}

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

.toast-error {
  border-color: var(--pill-bad-border);
}

.toast-error::before {
  background: var(--bad);
}

.toast-pending {
  border-color: var(--pill-warn-border);
}

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

.toast-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-close {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.toast-close:hover,
.toast-close:focus-visible {
  background: var(--surface-2);
  color: var(--text);
}

.form-error {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--pill-bad-border);
  border-radius: var(--radius);
  background: var(--pill-bad-bg);
  color: var(--pill-bad-fg);
  font-size: var(--font-sm);
  line-height: 1.4;
}

.settings-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #3f1f22;
  border-radius: 6px;
  background: #110c0d;
}

.settings-danger-zone strong {
  display: block;
  font-size: var(--font-md);
  font-weight: var(--weight-medium);
}

.settings-danger-zone span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--font-xs);
}

.settings-danger-zone button {
  min-height: 32px;
  padding: 6px 11px;
  font-size: var(--font-sm);
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .status-strip,
  .metric-grid,
  .card-grid,
  .grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar,
  .hero,
  .panel-head,
  .status-title,
  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    padding: 16px;
  }

  .auth-panel.login-screen {
    margin: -16px;
    padding: 34px 16px 48px;
  }

  .auth-card {
    width: 100%;
  }

  .status-strip,
  .metric-grid,
  .card-grid,
  .settings-tab-layout,
  .grid-two,
  .grid-form,
  .form-row {
    grid-template-columns: 1fr;
  }

  .settings-tabs {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topnav,
  .hero-actions,
  .action-row,
  .form-actions,
  .confirm-actions,
  .settings-actions,
  .settings-danger-zone {
    justify-content: flex-start;
  }

  .settings-danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-link,
  .button-link,
  button {
    width: 100%;
  }

  .message-item,
  .message-title-row {
    align-items: stretch;
  }

  .message-title-row,
  .message-actions {
    justify-content: flex-start;
  }

  .icon-button {
    width: 28px;
  }

  .icon-button.copy-secret-button {
    width: 30px;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
