:root {
  --ink: #121927;
  --navy: #09264a;
  --muted: #68758a;
  --line: #dce5ef;
  --panel: #ffffff;
  --wash: #edf4f8;
  --green: #62b95f;
  --green-soft: #eef8ee;
  --blue: #2196f3;
  --orange: #ff9800;
  --red: #f44336;
  --shadow: 0 12px 30px rgba(9, 38, 74, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #edf4f8 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-mark {
  font-size: 25px;
  font-weight: 800;
  color: #090d14;
  margin-bottom: 28px;
}

.brand-mark span {
  color: var(--green);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 27px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: var(--navy);
}

.login-form input,
.field,
.url-input,
.code-editor,
.response-box,
.select {
  width: 100%;
  border: 1px solid #b8c2cf;
  border-radius: 7px;
  background: #fafbfc;
  color: var(--ink);
}

.login-form input,
.field,
.url-input,
.select {
  height: 42px;
  padding: 0 14px;
}

.login-form button,
.primary-button {
  height: 44px;
  border: 0;
  border-radius: 5px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 8px rgba(98, 185, 95, 0.24);
}

#login-status {
  min-height: 20px;
  color: var(--red);
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e2e8f0;
}

.sidebar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 22px 30px;
}

.menu-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 21px;
  line-height: 1;
}

.nav {
  display: grid;
  gap: 7px;
  padding: 0 7px;
}

.nav button {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  height: 47px;
  border: 0;
  border-radius: 7px;
  padding: 0 24px;
  background: transparent;
  color: #334155;
  text-align: left;
}

.nav button.active {
  background: var(--green-soft);
  color: var(--green);
}

.nav svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav .divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

.plan-card {
  margin: auto 12px 20px;
  padding: 16px;
  border-radius: 7px;
  background: #dfe5ea;
  color: var(--navy);
}

.plan-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.plan-card small {
  color: var(--muted);
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  font-size: 12px;
  font-weight: 700;
}

.meter {
  height: 9px;
  margin-top: 7px;
  border-radius: 99px;
  overflow: hidden;
  background: #fff;
}

.meter span {
  display: block;
  height: 100%;
  width: var(--value, 12%);
  background: var(--navy);
}

.main {
  padding: 76px 18px 40px;
}

.top-avatar {
  position: fixed;
  top: 16px;
  right: 22px;
  z-index: 5;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 8px solid #e5e7eb;
  background: #b147c8;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.page-band {
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 8px 8px 0 0;
  background: var(--wash);
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 18px;
  border-radius: 7px;
  background: #fff;
}

.page-title h1 {
  margin: 0;
  font-size: 23px;
}

.crumb {
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.panel {
  margin-top: 18px;
  padding: 24px;
  border-radius: 7px;
  background: var(--panel);
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 21px;
}

.api-key-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  min-height: 51px;
  padding: 8px 10px 8px 14px;
  border: 1px solid #b8c2cf;
  border-radius: 7px;
  background: #fafbfc;
}

.key-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #263244;
}

.icon-button {
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
}

.icon-button:hover {
  background: #eef2f6;
}

.tabs {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-top: 28px;
}

.tab-button {
  min-width: 180px;
  height: 58px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: #fbfcfd;
  color: #9aa1aa;
  font-weight: 800;
}

.tab-button.active {
  border-bottom-color: var(--navy);
  color: var(--navy);
}

.request-row {
  display: grid;
  grid-template-columns: 96px 1fr 300px;
  gap: 12px;
  margin-top: 24px;
}

.info-box {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 7px;
  background: #dff4fb;
  color: var(--navy);
}

.subtabs {
  display: flex;
  gap: 18px;
  margin-top: 26px;
  border-bottom: 1px solid var(--line);
}

.subtab-button {
  height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.subtab-button.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

.headers-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
  padding: 18px 16px;
}

.code-editor,
.response-box {
  min-height: 180px;
  padding: 16px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.48;
}

.response-box {
  margin-top: 10px;
  min-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 24px;
  align-items: stretch;
}

.metric-card,
.ops-card,
.plan-box {
  padding: 24px;
  border-radius: 7px;
  background: #fff;
}

.metric-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.metric-card strong {
  display: block;
  font-size: 26px;
  color: var(--navy);
}

.metric-card .blue {
  color: var(--blue);
}

.metric-card .green {
  color: var(--green);
}

.metric-card .orange {
  color: var(--orange);
}

.chart {
  width: 100%;
  height: 290px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 130px 100px 120px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 28px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
  background: #edf2f7;
}

.status.SUCCESS {
  background: var(--green-soft);
  color: #248f3b;
}

.status.FAILED {
  background: #fff0ef;
  color: var(--red);
}

.status.PROCESSING {
  background: #e8f4ff;
  color: var(--blue);
}

.status.QUEUED {
  background: #fff6e5;
  color: var(--orange);
}

.small-button {
  height: 34px;
  border: 1px solid #b8c2cf;
  border-radius: 5px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
}

.danger-button {
  border-color: #ffc6c1;
  color: var(--red);
}

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

.ops-card h3,
.plan-box h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

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

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.kv span:first-child {
  color: var(--muted);
}

.kv span:last-child {
  overflow-wrap: anywhere;
  text-align: right;
  font-weight: 800;
  color: var(--navy);
}

.notice {
  padding: 16px;
  border: 1px solid var(--navy);
  border-radius: 7px;
  color: var(--navy);
  background: #eef4f8;
  text-align: center;
}

.empty {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 7px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .plan-card {
    display: none;
  }

  .main {
    padding-top: 22px;
  }

  .request-row,
  .metric-grid,
  .two-col,
  .config-grid,
  .plans-grid,
  .headers-grid,
  .command-row {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-button {
    min-width: 150px;
  }
}
