:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d7dee7;
  --accent: #0b6e4f;
  --accent-ink: #ffffff;
  --danger: #9b1c1c;
  --warn: #9a6700;
  --ok: #0b6e4f;
  --radius: 10px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9efe6 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e7eef8 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: #102033;
  color: #e8eef5;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.brand span { display: block; font-size: 0.75rem; color: #9fb0c3; font-weight: 400; margin-top: 0.25rem; }
.nav a {
  display: block;
  color: #d5e0ec;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.25rem;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.08); text-decoration: none; }
.main { padding: 1.5rem 2rem 3rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
h1 { margin: 0; font-size: 1.6rem; }
.muted { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.card .label { color: var(--muted); font-size: 0.85rem; }
.card .value { font-size: 1.8rem; font-weight: 700; margin-top: 0.35rem; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e8eef5;
}
.badge.active { background: #d9efe6; color: var(--ok); }
.badge.revoked { background: #fde8e8; color: var(--danger); }
.badge.superseded, .badge.expired { background: #fff4d6; color: var(--warn); }
form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem; }
form.grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
button, .btn {
  display: inline-block;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.secondary, .btn.secondary { background: #e8eef5; color: var(--ink); }
button.danger { background: var(--danger); }
.flash { background: #d9efe6; border: 1px solid #b6dfcf; padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.error { background: #fde8e8; border: 1px solid #f2bcbc; padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.mono { font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 18px 40px rgba(16, 32, 51, 0.08);
}
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.keybox {
  background: #102033;
  color: #e8eef5;
  padding: 1rem;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  form.grid { grid-template-columns: 1fr; }
}
