:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8deea;
  --accent: #0f766e;
  --accent-strong: #0b5d56;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

a {
  color: var(--accent-strong);
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 36px auto;
}

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

.brand h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 12px 30px rgba(18, 30, 54, 0.06);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: 360px 1fr;
  align-items: start;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 24px;
}

.stat span {
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 160px;
  resize: vertical;
}

.field {
  margin-bottom: 14px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row > * {
  flex: 1;
}

button,
.button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #e6edf3;
  color: var(--text);
}

button.secondary:hover {
  background: #d8e2ed;
}

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

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

.message {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.message.ok {
  border-color: #a6f4c5;
  color: var(--ok);
  background: #ecfdf3;
}

.message.error {
  border-color: #fecdca;
  color: var(--danger);
  background: #fef3f2;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  font-size: 13px;
  color: var(--muted);
}

td code {
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
}

.toolbar input,
.toolbar select {
  max-width: 240px;
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #eef4ff;
  color: #3538cd;
}

.pill.bound {
  background: #ecfdf3;
  color: var(--ok);
}

.pill.revoked {
  background: #fef3f2;
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.codebox {
  white-space: pre-wrap;
  word-break: break-all;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  min-height: 180px;
  overflow: auto;
}

.generated-actions {
  display: flex;
  gap: 10px;
  margin: 14px 0 10px;
}

@media (max-width: 860px) {
  .grid.two,
  .stats {
    grid-template-columns: 1fr;
  }

  .topbar,
  .toolbar,
  .row,
  .generated-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input,
  .toolbar select {
    max-width: none;
  }
}
