:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --panel-2: #232d3a;
  --text: #e8eef4;
  --muted: #93a1b0;
  --line: #2f3b4a;
  --ok: #2f9e6b;
  --bad: #c44747;
  --accent: #3d8fd1;
  --warn: #c4922a;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, #1d3a55 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #1a3328 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

.wrap {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand span {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  margin-left: 0.5rem;
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

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

h1, h2 {
  margin: 0 0 0.75rem;
  font-weight: 650;
}

h2 { font-size: 1.05rem; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.8rem;
  font: inherit;
}

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

.row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font: inherit;
  cursor: pointer;
}

button.primary, .btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

button.danger { background: #5a2424; border-color: transparent; }
button.ok { background: #1f5a3d; border-color: transparent; }
button.warn { background: #5a4518; border-color: transparent; }

.flash {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}

.flash.ok { background: #163527; border-color: #2f9e6b55; }
.flash.bad { background: #3a1c1c; border-color: #c4474755; }

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

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

th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
}

.badge.active { background: #1f5a3d; color: #b6f0d0; }
.badge.revoked { background: #5a2424; color: #ffc9c9; }

.key {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

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

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(400px, 100%);
}

.actions form {
  display: inline;
}

.wrap-wide {
  width: min(1280px, calc(100% - 2rem));
}

.filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 0.85rem;
  align-items: end;
  margin-bottom: 1rem;
}

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

select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 0.05rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.stat {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}

.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.stat.ok.on { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.stat.bad.on { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }

.stat strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.logs-table th,
.logs-table td {
  white-space: nowrap;
}

.logs-table td:nth-child(6),
.logs-table td:nth-child(10) {
  white-space: normal;
  min-width: 7rem;
}

.nowrap { white-space: nowrap; }

.row-pass td:nth-child(3) .badge { letter-spacing: 0.02em; }
.row-fail { background: color-mix(in srgb, #5a2424 18%, transparent); }
