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

:root {
  --bg:       #f4f6f9;
  --surface:  #ffffff;
  --border:   #dde1e7;
  --text:     #1a1d21;
  --muted:    #6b7280;
  --primary:  #2563eb;
  --danger:   #dc2626;
  --success:  #16a34a;
  --warning:  #d97706;
  --radius:   8px;
}

body { font-family: system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }

/* Nav */
.nav { background: var(--text); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; height: 52px; }
.nav-brand { font-weight: 700; letter-spacing: .3px; }
.nav-links a, .nav-links button { color: #d1d5db; text-decoration: none; margin-left: 1.5rem; background: none; border: none; cursor: pointer; font-size: 14px; }
.nav-links a:hover, .nav-links button:hover { color: #fff; }
.btn-link { padding: 0; }

/* Main */
.main { max-width: 1000px; margin: 2rem auto; padding: 0 1.5rem; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login-wrap .card { max-width: 380px; width: 100%; }
.login-wrap .card-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; text-align: center; }
.login-wrap input[type=password] { width: 100%; margin-top: .35rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; }
.login-wrap label { display: block; margin-bottom: 1rem; font-size: 14px; font-weight: 500; }
.login-wrap .btn { width: 100%; margin-top: .5rem; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.card-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.card-header .card-title { margin-bottom: 0; }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 14px; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }

/* Buttons */
.btn { display: inline-block; padding: .55rem 1.1rem; border-radius: var(--radius); border: none; cursor: pointer; font-size: 14px; font-weight: 500; text-decoration: none; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #c8cdd6; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* Forms */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-row label { display: flex; flex-direction: column; font-size: 14px; font-weight: 500; gap: .35rem; }
.form-row input, .form-row select { padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Key display */
.key-display { width: 100%; font-family: monospace; font-size: 12px; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); resize: vertical; min-height: 80px; background: #f8fafc; margin-bottom: .75rem; }
.warn { color: var(--danger); font-size: 13px; margin-bottom: .75rem; }
.warn-text { color: var(--warning); font-size: 12px; }

/* Badges */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-revoked   { background: #fee2e2; color: #b91c1c; }
.badge-suspended { background: #fef9c3; color: #a16207; }
.badge-unknown   { background: #f3f4f6; color: #6b7280; }

/* Tables */
.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th { text-align: left; padding: .6rem .75rem; border-bottom: 2px solid var(--border); color: var(--muted); font-weight: 600; white-space: nowrap; }
.list-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.list-table tr:last-child td { border-bottom: none; }
.list-table tr.row-expired td { color: var(--muted); }
.list-table a { color: var(--primary); text-decoration: none; font-weight: 500; }

.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 1.25rem; }
.detail-table th { text-align: left; padding: .55rem .75rem; width: 110px; color: var(--muted); font-weight: 600; }
.detail-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); }
.detail-table tr:last-child td { border-bottom: none; }

.action-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.action-row form { display: inline; }

.dashboard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.dashboard-header h2 { font-size: 1.2rem; font-weight: 700; }
