:root {
  --bg: #080a0f;
  --surface: #111520;
  --surface-2: #171c2b;
  --border: #232a3d;
  --text: #edf1f7;
  --muted: #8b95ab;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.14);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.14);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.14);
  --neutral-dim: rgba(148, 163, 184, 0.14);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 15% -10%, rgba(52, 211, 153, 0.1), transparent 60%),
    radial-gradient(500px circle at 85% 0%, rgba(56, 189, 248, 0.08), transparent 60%);
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-note {
  font-size: 0.9rem;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-valid {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(52, 211, 153, 0.3);
}

.badge-revoked,
.badge-invalid {
  color: var(--danger);
  background: var(--danger-dim);
  border-color: rgba(248, 113, 113, 0.3);
}

.badge-expired,
.badge-unverified {
  color: var(--warn);
  background: var(--warn-dim);
  border-color: rgba(251, 191, 36, 0.3);
}

.badge-neutral {
  color: var(--muted);
  background: var(--neutral-dim);
  border-color: rgba(148, 163, 184, 0.25);
}

.algo-pills {
  display: flex;
  gap: 6px;
}

.pill {
  padding: 3px 9px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.endpoint-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.endpoint-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.endpoint-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.endpoint-input {
  flex: 1 1 280px;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  outline: none;
}

.endpoint-input:focus {
  border-color: var(--accent);
}

.endpoint-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  color: #04130d;
}

.btn-primary:hover {
  background: #4ade80;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: #3a4563;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.24);
}

.meta-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.meta-item {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 11px 13px;
}

.meta-item dt {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-item dd {
  margin: 4px 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.certs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cert-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cert-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
}

.cert-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.cert-meta code {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.empty-state {
  margin: 0;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.usage-block h3 {
  margin: 0 0 6px;
  font-size: 0.88rem;
}

.usage-block p {
  margin: 0;
}

.code-box {
  margin: 0;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #cbd5e1;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer a:hover {
  color: var(--text);
}

.hidden {
  display: none !important;
}

/* Modal */
.modal {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  max-width: 560px;
  width: calc(100% - 24px);
}

.modal::backdrop {
  background: rgba(3, 5, 10, 0.75);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-desc {
  margin: 0;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--text);
  background: var(--surface-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field input[type="password"],
.field input[type="file"],
.field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.84rem;
}

.field textarea {
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
  cursor: pointer;
}

.feedback {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
}

.feedback.ok {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.feedback.err {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.modal-actions-right {
  display: flex;
  gap: 8px;
}
