:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #263449;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --danger: #ef4444;
  --warn: #f59e0b;
  --border: #334155;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

h1, h2, h3 { margin-top: 0; }

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 12px 0 6px;
}

input, select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 14px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: opacity .15s;
}
button:hover { opacity: 0.88; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #052e16; }
.btn-secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-block { width: 100%; }

.gate-button {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #34d399, #16a34a);
  color: white;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto;
  box-shadow: 0 8px 30px rgba(34,197,94,.25);
}
.gate-button:active { transform: scale(0.97); }
.gate-button.pulsing { animation: pulse 1s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  70% { box-shadow: 0 0 0 20px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.status-row { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.open { background: var(--warn); }
.dot.closed { background: var(--primary); }
.dot.unknown { background: var(--text-dim); }
.dot.online { background: var(--primary); }
.dot.offline { background: var(--danger); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.active { background: rgba(34,197,94,.15); color: var(--primary); }
.badge.revoked, .badge.expired { background: rgba(239,68,68,.15); color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }
.success-msg { color: var(--primary); font-size: 13px; margin-top: 8px; min-height: 18px; }
.hint { color: var(--text-dim); font-size: 12px; margin-top: 6px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  background: var(--card-2); color: var(--text-dim); border: 1px solid var(--border);
}
.tab-btn.active { background: var(--primary); color: #052e16; border-color: var(--primary); }

.link-box {
  background: var(--card-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  word-break: break-all;
  margin-top: 8px;
}

.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.logout-link { color: var(--text-dim); font-size: 13px; cursor: pointer; text-decoration: underline; }
