:root {
  --bg-primary: #0a0d14;
  --bg-surface: #121723;
  --bg-glass: rgba(18, 23, 35, 0.75);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-primary: #f0f4fc;
  --text-secondary: #9aa8c2;
  --accent-cyan: #00e5ff;
  --accent-blue: #2979ff;
  --accent-green: #00e676;
  --accent-red: #ff1744;
  --accent-warn: #ffab00;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #f4f6fa;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent-cyan: #0097a7;
    --accent-blue: #1d4ed8;
  }
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

.auth-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.auth-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.auth-header .project-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.qr-box {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  position: relative;
}

.qr-box canvas, .qr-box img {
  display: block;
  width: 220px;
  height: 220px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-warn);
  animation: pulse 1.8s infinite;
}

.status-dot.confirmed {
  background: var(--accent-green);
  animation: none;
}

.status-dot.expired {
  background: var(--accent-red);
  animation: none;
}

@keyframes pulse {
  0% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.5; transform: scale(0.9); }
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(41, 121, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(41, 121, 255, 0.45);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.legal-notice {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 16px;
}

.dashboard-nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  background: var(--bg-surface);
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 24px 0;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 4px;
}

.data-table {
  width: 100%;
  max-width: 1200px;
  border-collapse: collapse;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-weight: 600;
}

.tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  background: var(--bg-surface);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent-cyan);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active { background: rgba(0, 230, 118, 0.15); color: var(--accent-green); }
.badge-revoked { background: rgba(255, 23, 68, 0.15); color: var(--accent-red); }
.badge-frozen { background: rgba(255, 171, 0, 0.15); color: var(--accent-warn); }
.badge-system { background: rgba(0, 229, 255, 0.15); color: var(--accent-cyan); }

.mono {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 12px;
}

.btn-danger {
  background: rgba(255, 23, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(255, 23, 68, 0.3);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.show {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 100%;
  max-width: 500px;
}
