:root {
  color: #18201f;
  background: #f2f4f2;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #18201f;
  --muted: #697471;
  --line: #d8dedb;
  --surface: #ffffff;
  --accent: #087f6d;
  --accent-dark: #056657;
  --warning: #b56a12;
  --danger: #b93838;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f2f4f2;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f7fbf9;
  background: #172522;
  border-bottom: 3px solid #d89842;
}

.topbar-action {
  height: 34px;
  padding: 0 14px;
  color: #dbe8e4;
  background: transparent;
  border: 1px solid #668078;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 650;
}

.topbar-action:hover {
  color: #ffffff;
  border-color: #a9e2d6;
}

.brand-block,
.brand-block > div,
.result-header > div {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
}

.brand-block > div {
  align-items: baseline;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #83bcb0;
  color: #a9e2d6;
  font: 700 16px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0;
}

.brand-block p,
.section-title p {
  color: #87928f;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.environment {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5d2;
  font: 700 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.environment i,
.request-status i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: #d89842;
}

main {
  width: min(1180px, calc(100% - 48px));
  margin: 34px auto 64px;
}

.login-panel {
  width: min(560px, calc(100% - 48px));
  margin: 84px auto 120px;
  padding: 34px 38px 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
}

.login-kicker {
  margin-bottom: 18px;
  color: var(--accent);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.08em;
}

.login-panel h2 {
  font-size: 24px;
}

.login-panel p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-panel form {
  margin-top: 28px;
}

.login-panel label {
  display: block;
  margin-bottom: 8px;
  color: #45504d;
  font-size: 12px;
  font-weight: 650;
}

.login-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

.login-input-row .primary-button {
  margin-top: 0;
}

.login-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 12px;
}

.credential-band {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(320px, 1.35fr);
  gap: 36px;
  align-items: end;
  padding: 0 0 30px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-title.compact {
  margin-bottom: 24px;
}

.step {
  color: var(--accent);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0;
}

.credential-field > label,
.operation-form label > span {
  display: block;
  margin-bottom: 8px;
  color: #45504d;
  font-size: 12px;
  font-weight: 650;
}

.credential-field,
.operation-column {
  min-width: 0;
}

.secret-input,
.inline-control {
  display: flex;
  align-items: stretch;
}

.secret-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c9d1ce;
  border-radius: 4px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 109, 0.12);
}

.secret-input input,
.inline-control input {
  min-width: 0;
  border-radius: 4px 0 0 4px;
}

.secret-input input {
  width: 100%;
}

.quiet-button {
  min-width: 74px;
  padding: 0 14px;
  color: #36413e;
  background: #edf0ee;
  border: 1px solid #c9d1ce;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  font-weight: 650;
}

.quiet-button:hover {
  background: #e2e7e4;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 48px;
  padding-top: 34px;
}

.tabs {
  display: flex;
  height: 40px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-width: 116px;
  padding: 0 18px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 650;
}

.tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.operation-form {
  min-height: 370px;
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: #56615e;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.endpoint strong {
  padding: 4px 7px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 3px;
  font-size: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.toggle-field {
  align-self: end;
}

.toggle-row {
  height: 42px;
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.danger-button {
  background: #a43f3f;
  border-color: #a43f3f;
}

.danger-button:hover {
  background: #843131;
}

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

.regenerate {
  min-width: 92px;
}

.primary-button {
  width: 100%;
  height: 44px;
  margin-top: 24px;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.result-column {
  min-width: 0;
  padding-left: 32px;
  border-left: 1px solid var(--line);
}

.result-header,
.result-header > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-header > div {
  justify-content: flex-start;
  gap: 14px;
}

.result-header .quiet-button {
  height: 34px;
  border-radius: 4px;
}

.request-status {
  height: 36px;
  margin-top: 24px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #68736f;
  background: #e9ecea;
  border: 1px solid #d5dad7;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 650;
}

.request-status.success {
  color: #056657;
  background: #e3f2ee;
  border-color: #b9dcd3;
}

.request-status.success i {
  background: var(--accent);
}

.request-status.error {
  color: #8d2828;
  background: #f6e8e8;
  border-color: #e7c1c1;
}

.request-status.error i {
  background: var(--danger);
}

.request-status.loading i {
  background: var(--warning);
  animation: pulse 1s infinite alternate;
}

pre {
  min-height: 320px;
  max-height: 520px;
  margin: 12px 0 0;
  padding: 18px;
  overflow: auto;
  color: #d9e4e0;
  background: #17211f;
  border: 1px solid #0f1715;
  border-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.hidden {
  display: none !important;
}

.history-section {
  margin-top: 52px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

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

.history-header .section-title.compact {
  margin-bottom: 0;
}

.refresh-button {
  height: 34px;
  border-radius: 4px;
}

.history-state {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.history-state.error {
  color: var(--danger);
}

.history-state.loading {
  color: var(--warning);
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.history-entry {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.history-entry-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.history-entry-heading code {
  min-width: 0;
  overflow: hidden;
  color: #3f4b47;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.history-method,
.history-status {
  padding: 4px 7px;
  border-radius: 3px;
  font: 700 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.history-method {
  color: #ffffff;
  background: var(--accent);
}

.method-get {
  background: #4a6b86;
}

.history-status {
  color: #056657;
  background: #e3f2ee;
}

.history-status.error {
  color: #8d2828;
  background: #f6e8e8;
}

.history-entry time {
  color: #79837f;
  font-size: 11px;
  white-space: nowrap;
}

.history-body-label {
  margin-top: 13px;
  color: #697471;
  font-size: 11px;
  font-weight: 650;
}

.history-body {
  min-height: 0;
  max-height: 220px;
  margin-top: 6px;
  padding: 10px 12px;
  color: #42504b;
  background: #f3f6f4;
  border: 1px solid #e0e6e2;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.55;
}

@keyframes pulse {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@media (max-width: 820px) {
  .topbar {
    height: auto;
    min-height: 72px;
    padding: 14px 20px;
  }

  .brand-block > div {
    display: block;
  }

  .brand-block p {
    margin-top: 4px;
  }

  main {
    width: min(100% - 32px, 620px);
    margin-top: 24px;
  }

  .credential-band,
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .result-column {
    padding: 28px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .environment {
    display: none;
  }

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

  .full-width {
    grid-column: auto;
  }

  .inline-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .login-panel {
    width: min(100% - 32px, 560px);
    margin-top: 46px;
    padding: 26px 22px 28px;
  }

  .login-input-row {
    grid-template-columns: 1fr;
  }

  .history-header {
    align-items: stretch;
    flex-direction: column;
  }

  .refresh-button {
    width: 100%;
    border-radius: 4px;
  }

  .history-entry-heading {
    grid-template-columns: auto auto;
  }

  .history-entry-heading code {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .history-entry time {
    justify-self: end;
  }
}
