:root {
  font-family:
    "Sohne",
    "Neue Haas Grotesk Text",
    "Inter",
    system-ui,
    sans-serif;
  color: #14213d;
  background:
    radial-gradient(circle at top left, rgba(20, 33, 61, 0.08), transparent 34%),
    linear-gradient(180deg, #f7f4ed 0%, #f4efe4 100%);
  line-height: 1.4;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  background: #14213d;
  color: #fff;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    opacity 0.16s ease,
    background 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button.ghost {
  background: rgba(20, 33, 61, 0.08);
  color: #14213d;
}

button.danger {
  background: #8f2d1f;
}

textarea,
input {
  width: 100%;
  border: 1px solid rgba(20, 33, 61, 0.14);
  border-radius: 18px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.82);
  color: #14213d;
}

textarea {
  resize: vertical;
}

code {
  font-family:
    "JetBrains Mono",
    "SFMono-Regular",
    ui-monospace,
    monospace;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.loading-shell,
.authorize-shell {
  width: min(760px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.loading-panel {
  width: 100%;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, #14213d, #355070);
  box-shadow: 0 18px 50px rgba(20, 33, 61, 0.12);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: #8f5a2a;
}

.hero h1,
.loading-panel h1,
.authorize-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.02;
}

.hero h1 {
  max-width: 10ch;
}

.lede {
  margin: 14px 0 0;
  max-width: 56ch;
  color: rgba(20, 33, 61, 0.8);
}

.banner {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
}

.banner.success {
  background: rgba(61, 122, 68, 0.12);
  color: #235127;
}

.banner.error {
  background: rgba(143, 45, 31, 0.12);
  color: #7a2215;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.authorize-card {
  width: 100%;
  padding: 36px;
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.86)),
    linear-gradient(135deg, rgba(20, 33, 61, 0.12), rgba(53, 80, 112, 0.08));
  box-shadow: 0 24px 60px rgba(20, 33, 61, 0.14);
  display: grid;
  gap: 20px;
}

.authorize-meta,
.inline-actions,
.authorize-actions.simple,
.oauth-list,
.auth-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.authorize-summary,
.auth-panel,
.auth-method {
  display: grid;
  gap: 16px;
}

.authorize-summary {
  padding: 20px;
  border-radius: 24px;
  background: rgba(20, 33, 61, 0.05);
  border: 1px solid rgba(20, 33, 61, 0.08);
}

.authorize-summary strong {
  display: block;
  font-size: 1.05rem;
}

.authorize-link {
  color: #8f5a2a;
  text-decoration: none;
  font-weight: 600;
}

.authorize-link:hover {
  text-decoration: underline;
}

.panel {
  margin-top: 20px;
  padding: 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 40px rgba(20, 33, 61, 0.08);
}

.panel h2,
.panel h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.muted {
  color: rgba(20, 33, 61, 0.66);
}

.stack,
.agent-list,
.history-list,
.form,
.auth-method {
  display: grid;
  gap: 14px;
}

.balance-card {
  padding: 20px 22px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(20, 33, 61, 0.12), rgba(143, 90, 42, 0.14)),
    rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(20, 33, 61, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.balance-amount {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.balance-amount small {
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(20, 33, 61, 0.62);
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: rgba(20, 33, 61, 0.62);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value {
  display: block;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(20, 33, 61, 0.06);
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.08);
  color: #14213d;
  font-size: 0.9rem;
}

.pill.compact {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.panel-row,
.agent-row,
.history-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.agent-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(20, 33, 61, 0.04);
  border: 1px solid rgba(20, 33, 61, 0.08);
}

.agent-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.agent-summary h3 {
  margin: 0;
}

.agent-id,
.agent-meta {
  color: rgba(20, 33, 61, 0.62);
}

.agent-meta {
  font-size: 0.95rem;
}

.history-item {
  border: 1px solid rgba(20, 33, 61, 0.08);
  border-radius: 16px;
  background: rgba(20, 33, 61, 0.04);
  overflow: hidden;
}

.history-summary {
  list-style: none;
  padding: 14px 16px;
  cursor: pointer;
}

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

.history-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-main code {
  overflow-wrap: anywhere;
}

.history-time {
  color: rgba(20, 33, 61, 0.62);
  white-space: nowrap;
}

.history-details {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

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

.history-error {
  color: #8f2d1f;
}

.history-payload {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(20, 33, 61, 0.06);
  border: 1px solid rgba(20, 33, 61, 0.08);
  font-family:
    "JetBrains Mono",
    "SFMono-Regular",
    ui-monospace,
    monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-grid {
  align-items: stretch;
}

.auth-method {
  margin-top: 0;
  flex: 1 1 280px;
}

.auth-method label {
  display: grid;
  gap: 8px;
}

.auth-oauth-button {
  justify-content: center;
}

@media (max-width: 860px) {
  .hero,
  .panel-row,
  .agent-row,
  .history-summary,
  .authorize-actions.simple {
    flex-direction: column;
  }

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