:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0f172a;
  --accent: #10b981;
  --danger: #e11d48;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  background: #0f172a;
  color: white;
}

.topbar h1 { margin: 0; font-size: 18px; }
.topbar p { margin: 4px 0 0; color: #94a3b8; font-size: 12px; }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card h2 { margin: 0 0 14px; font-size: 15px; }

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

input, select {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  background: white;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.actions.full { grid-column: 1 / -1; }

.btn {
  height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { opacity: 0.9; }
.btn.secondary { background: #1e293b; }
.btn.success { background: var(--accent); }
.btn.danger { background: var(--danger); }
.btn.warning { background: var(--warning); color: #111827; }
.btn.small { height: 30px; padding: 0 10px; font-size: 11px; }

.hint { color: var(--muted); font-size: 11px; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
}

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }

th {
  text-align: left;
  padding: 10px 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

tr:last-child td { border-bottom: 0; }

.status { font-weight: 600; }
.status.ACTIVE { color: #047857; }
.status.PENDING { color: #b45309; }
.status.REVOKED, .status.REJECTED { color: #be123c; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

.key-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}

.hidden { display: none; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #0f172a;
  color: white;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}

.toast.error { background: #9f1239; }
