* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0; padding: 0; background: #f3f4f6; color: #1f2937;
  min-height: 100vh;
}

.view { min-height: 100vh; }
.hidden { display: none !important; }

/* ============ LOGIN ============ */
#login-view {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  padding: 20px;
}
.login-card {
  background: #fff; padding: 32px; border-radius: 10px;
  width: 100%; max-width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-card h1 {
  margin: 0 0 4px; font-size: 24px; color: #1f2937; text-align: center;
}
.login-sub {
  margin: 0 0 24px; font-size: 14px; color: #6b7280; text-align: center;
}
#pwd-login-form {
  display: flex; flex-direction: column; gap: 14px;
}
#pwd-login-form label {
  display: flex; flex-direction: column; font-size: 12px; color: #6b7280; gap: 4px;
}
#pwd-login-form input {
  padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 5px;
  font-size: 14px; font-family: inherit;
}
#pwd-login-form button {
  padding: 10px; background: #3b82f6; color: #fff; border: none;
  border-radius: 5px; font-size: 14px; cursor: pointer; font-weight: 600;
  margin-top: 4px;
}
.hint-small {
  font-size: 11px; color: #9ca3af; text-align: center; margin: 10px 0 0;
}
.hint-small code { background: #f3f4f6; padding: 1px 4px; border-radius: 3px; }

.login-sep {
  text-align: center; margin: 24px 0 16px; position: relative;
}
.login-sep::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: #e5e7eb;
}
.login-sep span {
  background: #fff; padding: 0 12px; font-size: 11px; color: #9ca3af;
  text-transform: uppercase; letter-spacing: 1px; position: relative;
}
.bio-login-buttons {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.bio-login-buttons button {
  padding: 12px 8px; background: #fff; color: #1f2937; border: 1px solid #d1d5db;
  border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 500;
}
.bio-login-buttons button:hover { background: #f9fafb; }

.error-msg {
  background: #fee2e2; color: #991b1b; padding: 10px;
  border-radius: 5px; font-size: 13px; margin: 14px 0 0;
  white-space: pre-wrap; word-break: break-word;
}

/* ============ DASHBOARD ============ */
.topbar {
  background: #1f2937; color: #fff; padding: 12px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }
.user-bar {
  display: flex; gap: 12px; align-items: center; font-size: 13px;
}
#user-greeting { color: #d1d5db; }
.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
  background: #374151; color: #d1fae5; font-family: monospace;
}
.badge.ok { background: #065f46; color: #fff; }
.badge.warn { background: #92400e; color: #fff; }
.badge.empty { background: #4b5563; color: #d1d5db; }

button {
  background: #3b82f6; color: #fff; border: none; padding: 8px 14px;
  border-radius: 4px; cursor: pointer; font-size: 13px; font-family: inherit;
  font-weight: 500;
}
button:hover { background: #2563eb; }
button:disabled { background: #9ca3af; cursor: not-allowed; }
button.secondary { background: #6b7280; }
button.secondary:hover { background: #4b5563; }
button.danger { background: #ef4444; }
button.danger:hover { background: #dc2626; }
button.small { padding: 4px 8px; font-size: 11px; }

nav.tabs {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  display: flex; padding: 0 24px;
}
.tab {
  background: none; color: #6b7280; padding: 14px 18px;
  border-radius: 0; border-bottom: 2px solid transparent;
  font-weight: 500;
}
.tab.active { color: #1f2937; border-bottom-color: #3b82f6; }
.tab:hover { background: transparent; color: #1f2937; }

main { padding: 24px; max-width: 1100px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }

.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.panel-header h2 { margin: 0; font-size: 18px; }

.hint {
  background: #eff6ff; border-left: 3px solid #3b82f6;
  padding: 10px 14px; font-size: 13px; color: #1e40af;
  margin: 0 0 16px; border-radius: 0 4px 4px 0;
}

/* ============ DATA TABLE ============ */
.data-table {
  width: 100%; background: #fff; border-radius: 6px; overflow: hidden;
  border: 1px solid #e5e7eb; border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: 10px 14px; text-align: left; font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}
.data-table th {
  background: #f9fafb; font-weight: 600; color: #374151;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }
.data-table td .actions { display: flex; gap: 4px; }
.data-table td .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  font-size: 10px; background: #e0e7ff; color: #3730a3;
  padding: 2px 6px; border-radius: 8px;
}

/* ============ METHOD CARDS ============ */
.method-card {
  background: #fff; padding: 16px; border-radius: 6px;
  border: 1px solid #e5e7eb; margin-bottom: 12px;
}
.method-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.method-head h3 { margin: 0; font-size: 15px; }
.cred-list {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px;
}
.cred-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: #f9fafb; border-radius: 4px;
  font-size: 13px;
}
.cred-row .cred-meta { color: #6b7280; font-size: 11px; }
.cred-row .cred-label { font-weight: 500; }

/* ============ MODALS ============ */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-card {
  background: #fff; padding: 24px; border-radius: 8px;
  width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
}
.modal-card.wide { max-width: 640px; }
.modal-card h2 { margin: 0 0 16px; font-size: 18px; }
.modal-card h3 { margin: 20px 0 10px; font-size: 14px; }
.modal-card form {
  display: flex; flex-direction: column; gap: 12px;
}
.modal-card form label {
  display: flex; flex-direction: column; font-size: 12px; color: #6b7280; gap: 4px;
}
.modal-card form input, .modal-card form select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 4px;
  font-size: 14px; font-family: inherit;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;
  flex-wrap: wrap;
}
.modal-error {
  background: #fee2e2; color: #991b1b; padding: 8px 10px;
  border-radius: 4px; font-size: 12px; margin: 0;
  white-space: pre-wrap; word-break: break-word;
}
.inline-form {
  display: flex; gap: 8px; align-items: stretch;
}
.inline-form select {
  flex: 1; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 4px;
  font-size: 14px; font-family: inherit;
}

/* ============ BIOMETRIC CAMERA (sci-fi) ============ */
.bio-block {
  background: #000;
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 4px;
  padding: 4px;
  margin: 12px 0;
  display: inline-block;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25), inset 0 0 12px rgba(0, 240, 255, 0.08);
}
.bio-block::before, .bio-block::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid #00f0ff;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}
.bio-block::before {
  top: -1px; left: -1px;
  border-right: none; border-bottom: none;
}
.bio-block::after {
  bottom: -1px; right: -1px;
  border-left: none; border-top: none;
}
.bio-block video {
  display: block; width: 320px; height: 240px; background: #050a14;
  border-radius: 2px; object-fit: cover; transform: scaleX(-1);
}
.bio-block canvas {
  position: absolute; top: 4px; left: 4px;
  width: 320px; height: 240px; pointer-events: none;
  transform: scaleX(-1);
}
.bio-status {
  font-size: 12px; color: #6b7280; font-family: "SF Mono", Menlo, Consolas, monospace;
  background: #0a0f1a; color: #6b7280;
  padding: 8px 12px; border-radius: 4px;
  margin: 4px 0 0; letter-spacing: 0.3px;
  border: 1px solid rgba(0, 240, 255, 0.15);
}
.bio-status.ready {
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.5);
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}
.bio-status.loading {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.4);
}
.bio-status.error {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.4);
}
