:root {
  --bg: #15101f;
  --panel: #1e1830;
  --panel-2: #271f3d;
  --border: #392f52;
  --purple: #7c5cbf;
  --purple-bright: #9b7fe0;
  --gold: #e8b34f;
  --text: #ece7f7;
  --text-dim: #a79ccb;
  --red: #e05a5a;
  --green: #6fcf7a;
}

* { box-sizing: border-box; }

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

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

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.sidebar .brand img { width: 36px; height: 36px; object-fit: contain; }
.sidebar .brand span { font-weight: 700; letter-spacing: 0.5px; font-size: 15px; color: var(--gold); white-space: nowrap; }

.sidebar nav a {
  display: block;
  padding: 10px 18px;
  color: var(--text-dim);
  border-left: 3px solid transparent;
}

.sidebar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.sidebar nav a.active { color: var(--gold); border-left-color: var(--gold); background: var(--panel-2); }

.main { flex: 1; padding: 24px 32px; max-width: 1100px; }

h1 { margin-top: 0; color: var(--text); }
h2 { color: var(--text); font-size: 17px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.stat-row { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  min-width: 150px;
}
.stat .value { font-size: 26px; font-weight: 700; color: var(--gold); }
.stat .label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
tr:hover td { background: var(--panel-2); }

input, select, button, textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

button, .btn {
  background: var(--purple);
  border: none;
  color: white;
  cursor: pointer;
  font-weight: 600;
}
button:hover, .btn:hover { background: var(--purple-bright); text-decoration: none; }
button.danger { background: var(--red); }
button.danger:hover { background: #ff7a7a; }

form.inline { display: inline; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.badge.active { background: rgba(111,207,122,.15); color: var(--green); }
.badge.expired { background: rgba(167,156,203,.15); color: var(--text-dim); }
.badge.revoked { background: rgba(224,90,90,.15); color: var(--red); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.ok { background: rgba(111,207,122,.15); color: var(--green); border: 1px solid rgba(111,207,122,.3); }
.flash.err { background: rgba(224,90,90,.15); color: var(--red); border: 1px solid rgba(224,90,90,.3); }

.login-page {
  min-height: 100vh;
  display: flex;
}

.login-page .brand-panel {
  flex: 1 1 42%;
  max-width: 480px;
  background: linear-gradient(160deg, #1b1430 0%, #15102a 60%, #110c22 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 44px;
}

.login-page .brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-page .brand-mark img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; }
.login-page .brand-mark span { font-weight: 700; letter-spacing: 0.5px; font-size: 16px; color: var(--text); }

.login-page .brand-copy h1 {
  font-size: 26px;
  line-height: 1.3;
  margin: 0 0 12px;
  color: var(--text);
}
.login-page .brand-copy p {
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 360px;
}

.login-page .brand-foot {
  color: var(--text-dim);
  font-size: 12px;
}

.login-page .form-panel {
  flex: 1 1 58%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: left;
}

.login-box h2 { font-size: 19px; margin: 0 0 4px; }
.login-box .subtitle { color: var(--text-dim); font-size: 13px; margin: 0 0 22px; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

@media (max-width: 760px) {
  .login-page { flex-direction: column; }
  .login-page .brand-panel { max-width: none; border-right: none; border-bottom: 1px solid var(--border); padding: 32px 28px; }
  .login-page .brand-copy h1 { font-size: 20px; }
}

pre.console-output {
  background: #0d0a16;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  font-size: 12px;
}

.muted { color: var(--text-dim); }
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1; }
