:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5f6b7a;
  --line: #d9e1e8;
  --panel: #ffffff;
  --surface: #f6f8fb;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --blue: #2563eb;
  --amber: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 700;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

.status-pill {
  min-width: 120px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  background: #ffffff;
}

.status-pill.active {
  border-color: #b7e3c4;
  color: var(--ok);
  background: #edf9f0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(420px, 1fr);
  gap: 18px;
  padding: 24px clamp(18px, 4vw, 48px);
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.setup-panel {
  padding: 18px;
}

.manage-panel {
  padding: 18px;
}

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

.panel-heading > * {
  min-width: 0;
}

.panel-heading p {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: right;
}

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

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  background: #ffffff;
}

input:focus {
  outline: 3px solid rgba(37, 99, 235, 0.14);
  border-color: var(--blue);
}

button,
a.primary-button {
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  color: #ffffff;
  background: var(--teal);
}

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

.secondary-button,
.danger-button,
.icon-button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: #9fb1c1;
  background: #f9fbfc;
}

.danger-button {
  color: var(--danger);
}

.danger-button:hover {
  border-color: #f0b4b4;
  background: #fff7f7;
}

button:disabled,
a.primary-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

button:disabled:hover {
  border-color: var(--line);
  background: inherit;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.result-box,
.empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #c8e0da;
  border-radius: 8px;
  background: #f1faf7;
}

.empty-state {
  align-items: flex-start;
  flex-direction: column;
  border-color: var(--line);
  color: var(--muted);
  background: #fafbfc;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state span {
  overflow-wrap: anywhere;
}

.label,
.section-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

dl {
  display: grid;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

dl div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 12px;
  background: #ffffff;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.status-text {
  font-weight: 700;
}

.status-text.active {
  color: var(--ok);
}

.status-text.paused {
  color: var(--amber);
}

.key-list {
  margin-top: 20px;
}

.key-list ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.key-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.key-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.key-state.active {
  color: var(--ok);
  background: #edf9f0;
}

.key-state.revoked {
  color: var(--danger);
  background: #fff7f7;
}

code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.footnote {
  padding: 0 clamp(18px, 4vw, 48px) 28px;
  color: var(--muted);
  font-size: 13px;
}

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

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 520px) {
  .setup-panel .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .setup-panel .panel-heading p {
    text-align: left;
  }

  .result-box {
    align-items: stretch;
    flex-direction: column;
  }

  dl div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
