:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --font: "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: linear-gradient(160deg, #0a0e14 0%, #121a28 50%, #0f1419 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.page { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.brand { display: flex; gap: 1rem; align-items: center; }
.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
  display: block;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
}
h1 { font-size: 1.35rem; font-weight: 600; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }

.user-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  max-width: 320px;
}
.user-bar .name { font-weight: 600; }
.user-bar .oid { color: var(--muted); font-size: 0.75rem; word-break: break-all; margin-top: 0.25rem; }
.user-bar button {
  margin-top: 0.5rem; background: transparent; border: 1px solid var(--surface2);
  color: var(--muted); padding: 0.25rem 0.6rem; border-radius: 6px; cursor: pointer;
}
.user-bar button:hover { color: var(--text); border-color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card.center { text-align: center; padding: 2.5rem 1.5rem; }
.card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.card p { color: var(--muted); margin-bottom: 1rem; }

.hidden { display: none !important; }

.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--surface2);
  color: var(--text);
  background: var(--surface2);
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn:hover { filter: brightness(1.05); }

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.stat .label { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 0.35rem; }
.stat .value { font-size: 1.5rem; font-weight: 600; }
.stat .value.small { font-size: 0.95rem; font-weight: 500; }

.row-between { display: flex; justify-content: space-between; align-items: center; }
.badge {
  background: var(--surface2);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
}

.progress-wrap {
  height: 10px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.75rem 0;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #6366f1);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-bar.warn { background: linear-gradient(90deg, var(--warn), #f97316); }
.progress-bar.danger { background: linear-gradient(90deg, var(--danger), #dc2626); }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags span {
  background: var(--surface2);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.error { color: var(--danger); margin-top: 1rem; font-size: 0.9rem; }
.muted { color: var(--muted); font-size: 0.88rem; }

.form { display: grid; gap: 0.75rem; max-width: 480px; margin-bottom: 1.5rem; }
.form label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.form input {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.table-wrap { overflow-x: auto; font-size: 0.85rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--surface2); }
th { color: var(--muted); font-weight: 500; }
.revoked { opacity: 0.5; }
.failed { background: rgba(239, 68, 68, 0.08); }
.fail { color: var(--danger); font-size: 0.82rem; }

.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn.danger:hover { background: rgba(239, 68, 68, 0.12); }

.pager { display: flex; align-items: center; gap: 0.5rem; }
.pager .btn { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.pager .btn:disabled { opacity: 0.4; cursor: not-allowed; }

.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  margin: 1rem 0;
  padding: 0 0.25rem;
  overflow-x: auto;
}
.daily-bar {
  flex: 1;
  min-width: 28px;
  max-width: 48px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.daily-fill {
  width: 100%;
  min-height: 2px;
  background: linear-gradient(180deg, #6366f1, var(--accent));
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}
.daily-label {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

input[readonly] {
  opacity: 0.75;
  cursor: not-allowed;
}
