:root {
  color-scheme: light;
  --bg: #f4f8fc;
  --surface: #ffffff;
  --surface-strong: #f5f9fd;
  --line: rgba(0, 133, 208, 0.16);
  --text: #18304b;
  --muted: #687f96;
  --blue: #0085d0;
  --cyan: #16a6c9;
  --green: #159b68;
  --amber: #c97a1a;
  --red: #d84f60;
  --radius: 19px;
  font-family: Inter, "SF Pro Display", "Segoe UI", "Microsoft YaHei UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: #fff; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -10%, rgba(0, 133, 208, 0.11), transparent 34rem),
    radial-gradient(circle at -8% 55%, rgba(22, 166, 201, 0.07), transparent 28rem),
    linear-gradient(155deg, #ffffff, #f4f8fc 55%, #ffffff);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  content: "";
  opacity: 0.32;
  background-image: linear-gradient(rgba(0, 133, 208, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 133, 208, 0.06) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(to bottom, #000, transparent 86%);
}
.glow { position: fixed; z-index: -2; width: 30rem; height: 30rem; border-radius: 50%; filter: blur(100px); pointer-events: none; }
.glow-a { top: -16rem; right: -8rem; background: rgba(0, 133, 208, 0.1); }
.glow-b { bottom: -18rem; left: -12rem; background: rgba(22, 166, 201, 0.06); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: #0079be; }
.shell { width: min(1480px, calc(100% - 44px)); margin: 0 auto; padding: 30px 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 8px 5px 27px; }
.identity { display: flex; align-items: center; gap: 14px; }
.identity p, .kicker { margin: 0 0 5px; color: #0085d0; font-size: .65rem; font-weight: 700; letter-spacing: .18em; }
.identity h1 { margin: 0; font-size: 1.35rem; letter-spacing: -.025em; }
.logo { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid rgba(0, 133, 208, .24); border-radius: 15px; background: linear-gradient(145deg, #0085d0, #20a9d4); box-shadow: 0 10px 30px rgba(0, 133, 208, .18); }
.logo span { color: #ffffff; font-size: 1.22rem; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #ffffff; font-size: .72rem; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: #68768b; }
.badge-on { color: #12855b; border-color: rgba(21, 155, 104, .25); }
.badge-on i { background: var(--green); box-shadow: 0 0 12px var(--green); }
.card, .metric-card { border: 1px solid var(--line); border-radius: var(--radius); background: #ffffff; box-shadow: 0 18px 48px rgba(35, 83, 116, .09); }
.login-wrap { display: grid; min-height: calc(100vh - 180px); place-items: center; }
.login-card { width: min(450px, 100%); padding: 34px; }
.login-card h2, .section-head h2 { margin: 0; letter-spacing: -.03em; }
.login-card h2 { font-size: 1.65rem; }
.muted { margin: 10px 0 24px; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.secure-note { display: flex; flex-direction: column; gap: 4px; margin-top: 23px; padding: 14px; border: 1px solid rgba(21, 155, 104, .16); border-radius: 11px; background: rgba(21, 155, 104, .05); }
.secure-note strong { color: #12855b; font-size: .7rem; }
.secure-note span { color: #6d8296; font-size: .67rem; line-height: 1.5; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.metric-card { min-height: 128px; padding: 20px; }
.metric-card > span { display: block; color: #71879c; font-size: .72rem; }
.metric-card strong { display: block; margin: 13px 0 8px; color: #1c405f; font-size: 1.65rem; font-weight: 600; letter-spacing: -.035em; }
.metric-card small { color: #7d90a2; font-size: .68rem; }
.metric-accent { border-color: rgba(0, 133, 208, .23); background: linear-gradient(135deg, rgba(0, 133, 208, .09), rgba(22, 166, 201, .05)); }
.metric-accent strong { color: #0079be; }
.main-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, .75fr); gap: 18px; margin-bottom: 18px; }
.upstream-card, .endpoint-card, .key-management, .tasks-card { padding: 25px; }
.key-management, .tasks-card { margin-bottom: 18px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 21px; }
.section-head h2 { font-size: 1.22rem; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.field > span { color: #36536d; font-size: .74rem; font-weight: 650; }
.field small { color: #6e84a1; font-size: .64rem; }
input { width: 100%; height: 45px; padding: 0 12px; color: var(--text); border: 1px solid rgba(0, 133, 208, .2); border-radius: 11px; outline: none; background: #ffffff; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: rgba(0, 133, 208, .55); box-shadow: 0 0 0 3px rgba(0, 133, 208, .09); }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 14px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 19px; }
.form-actions p { margin: 0; color: #7086a3; font-size: .68rem; line-height: 1.5; }
.button-row, .row-actions { display: flex; align-items: center; gap: 8px; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; color: var(--text); border: 1px solid transparent; border-radius: 10px; transition: transform .15s, opacity .15s, border-color .15s; }
.button { min-height: 43px; padding: 0 17px; font-size: .74rem; font-weight: 700; text-decoration: none; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .42; }
.button-primary { color: #ffffff; background: linear-gradient(115deg, #0085d0, #18a3cf); box-shadow: 0 10px 24px rgba(0, 133, 208, .2); }
.button-secondary { color: #0079be; border-color: rgba(0, 133, 208, .28); background: rgba(0, 133, 208, .06); }
.button-ghost { color: #597188; border-color: var(--line); background: #ffffff; }
.button-danger { color: #bd3247; border-color: rgba(200, 63, 82, .24); background: #fff4f5; }
.button-small { min-height: 34px; padding: 0 12px; font-size: .67rem; }
.button-full { width: 100%; margin-top: 18px; }
.icon-button { min-width: 34px; height: 34px; padding: 0 9px; color: #0079be; border-color: var(--line); background: rgba(0, 133, 208, .05); font-size: .7rem; }
.message { min-height: 1.25em; margin: 10px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.message-success { color: #12855b; }
.message-error { color: #c83f52; }
.message-warning { color: var(--amber); }
.message-working { color: #0079be; }
.endpoint-line { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid rgba(0, 133, 208, .15); border-radius: 10px; background: #f5f9fd; }
.endpoint-line span { padding: 4px 7px; color: #12855b; border-radius: 6px; background: rgba(21, 155, 104, .08); font-size: .61rem; font-weight: 800; }
.endpoint-line code { overflow: hidden; color: #31536e; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
pre { min-height: 164px; margin: 12px 0; padding: 15px; overflow: auto; color: #2c4f69; border: 1px solid #dceaf4; border-radius: 11px; background: #f4f8fc; font: .66rem/1.7 Consolas, monospace; white-space: pre-wrap; }
.hint { margin: 0; color: #6c819d; font-size: .65rem; line-height: 1.55; }
.soft-limit { padding: 6px 10px; color: var(--amber); border: 1px solid rgba(255, 208, 122, .2); border-radius: 999px; background: rgba(255, 190, 57, .06); font-size: .65rem; }
.key-form-grid { display: grid; grid-template-columns: 1.1fr 1fr .65fr .9fr .65fr 1.2fr; gap: 11px; }
.issued-key { position: relative; display: grid; grid-template-columns: auto minmax(220px, 1fr) auto auto; gap: 14px; align-items: center; margin: 20px 0; padding: 16px; border: 1px solid rgba(0, 133, 208, .25); border-radius: 13px; background: linear-gradient(120deg, rgba(0, 133, 208, .08), rgba(22, 166, 201, .04)); }
.issued-key > div { display: flex; flex-direction: column; gap: 4px; }
.issued-key span { color: #84a6c6; font-size: .62rem; }
.issued-key strong { color: #0079be; font-size: .7rem; }
.issued-key code { overflow: auto; padding: 10px; color: #244a65; border: 1px solid #dceaf4; border-radius: 8px; background: #ffffff; font: .72rem Consolas, monospace; white-space: nowrap; }
.table-wrap { position: relative; margin-top: 21px; overflow-x: auto; }
table { width: 100%; min-width: 930px; border-collapse: collapse; }
th, td { padding: 13px 10px; text-align: left; border-bottom: 1px solid rgba(111, 159, 217, .1); font-size: .69rem; }
th { color: #6f86a3; font-size: .62rem; font-weight: 650; letter-spacing: .03em; }
td { color: #496279; }
.stacked { display: flex; flex-direction: column; gap: 4px; }
.stacked strong { color: #284963; font-size: .72rem; }
.stacked small { color: #6e84a0; font-size: .62rem; }
.status { display: inline-flex; padding: 5px 8px; color: #657d93; border: 1px solid var(--line); border-radius: 999px; background: #f7fafc; font-size: .62rem; white-space: nowrap; }
.status-active, .status-succeeded { color: #12855b; border-color: rgba(21, 155, 104, .22); }
.status-running, .status-queued, .status-pending, .status-submitted { color: #0079be; border-color: rgba(0, 133, 208, .22); }
.status-revoked, .status-expired, .status-failed, .status-cancelled, .status-canceled { color: #c83f52; border-color: rgba(216, 79, 96, .22); }
.status-task_quota_exhausted, .status-token_quota_exhausted { color: #a96508; border-color: rgba(201, 122, 26, .28); background: #fff9ef; }
.money { color: #0079be; }
.mono { max-width: 190px; overflow: hidden; font-family: Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.text-button { padding: 4px; color: #0079be; border: 0; background: transparent; font-size: .65rem; }
.text-button:disabled { opacity: .35; }
.danger-text { color: #c83f52; }
.empty-table { margin: 23px 0 5px; color: #637995; text-align: center; font-size: .7rem; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 10px 5px 0; color: #5f738d; font-size: .65rem; }
footer a { color: #0079be; text-underline-offset: 3px; }
@media (max-width: 1180px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .main-grid { grid-template-columns: 1fr; }
  .key-form-grid { grid-template-columns: repeat(3, 1fr); }
  .notes-field { grid-column: span 2; }
}
@media (max-width: 720px) {
  .shell { width: calc(100% - 22px); padding-top: 18px; }
  .topbar, .section-head, .form-actions, footer { align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: space-between; }
  .metrics, .two-fields, .key-form-grid { grid-template-columns: 1fr; }
  .notes-field { grid-column: auto; }
  .upstream-card, .endpoint-card, .key-management, .tasks-card { padding: 19px; }
  .issued-key { grid-template-columns: 1fr; }
  .issued-key .icon-button { position: absolute; top: 8px; right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
