:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 0.9375rem;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

header {
  background: var(--surface);
  padding: 0.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

header h1 {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

nav a {
  margin-left: 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 0.875rem;
}

label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 500;
  font-size: 0.875rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  border: 1px solid var(--primary-dark);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.15),
    0 1px 0 0 rgba(0, 0, 0, 0.05);
  transition: background 0.1s, box-shadow 0.1s;
}

button:hover {
  background: var(--primary-dark);
  box-shadow:
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.2),
    0 2px 1px 0 rgba(0, 0, 0, 0.06);
}

button:active {
  box-shadow: inset 0 2px 2px 0 rgba(0, 0, 0, 0.1);
}

button.danger {
  background: var(--surface);
  border-color: var(--border);
  color: var(--danger);
  box-shadow:
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.06),
    0 1px 0 0 rgba(0, 0, 0, 0.03);
}

button.danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
  box-shadow:
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.08),
    0 2px 1px 0 rgba(0, 0, 0, 0.04);
}

button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
  box-shadow:
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.06),
    0 1px 0 0 rgba(0, 0, 0, 0.03);
}

button.secondary:hover {
  background: #f9fafb;
  color: var(--text);
  box-shadow:
    inset 0 -2px 0 0 rgba(0, 0, 0, 0.1),
    0 2px 1px 0 rgba(0, 0, 0, 0.04);
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.625rem 0.75rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
}

.success {
  color: var(--success);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.625rem 0.75rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.actions {
  display: flex;
  gap: 0.375rem;
}

.actions button {
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
}

.empty {
  color: var(--text-subtle);
  font-size: 0.875rem;
  font-style: italic;
  padding: 0.5rem 0;
}

.app-name {
  font-weight: 500;
}

.app-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

code {
  background: #f3f4f6;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.8125rem;
  font-family:
    IBMPlexMono, ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;
  color: #374151;
}

.token-item {
  display: flex;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

.token-item:last-of-type {
  border-bottom: none;
}

.token-info {
  flex: 1;
}

.token-name {
  font-weight: 500;
  font-size: 0.875rem;
}

.token-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

button.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  min-height: 26px;
}

dialog {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  max-width: 460px;
  width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.3);
}

dialog h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

dialog hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.375rem 1rem;
}

dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

dd {
  font-size: 0.8125rem;
  word-break: break-all;
  color: var(--text);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --surface: #1f2937;
    --border: #374151;
    --text: #f9fafb;
    --text-muted: #9ca3af;
    --text-subtle: #6b7280;
  }

  code {
    background: #374151;
    color: #e5e7eb;
  }

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

  button.danger:hover {
    background: #1c0505;
    border-color: #7f1d1d;
    color: #fca5a5;
  }

  .error {
    background: #1c0505;
    border-color: #7f1d1d;
    color: #fca5a5;
  }

  .success {
    background: #052e16;
    border-color: #166534;
    color: #86efac;
  }
}
