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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* Screens */
.screen { width: 100%; }
.hidden { display: none !important; }

/* Login */
.login-box {
  max-width: 360px;
  margin: 15vh auto;
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-box h1 { font-size: 1.5rem; color: #1a1a2e; }
.login-box p { color: #666; font-size: 0.9rem; }

/* Header */
header {
  background: white;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
header h1 { font-size: 1.2rem; }

/* Main */
main {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Card */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 12px 24px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
}
td {
  padding: 14px 24px;
  border-bottom: 1px solid #f7f7f7;
  font-size: 0.9rem;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.loading { color: #aaa; font-style: italic; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-active { background: #dcfce7; color: #16a34a; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-revoked { background: #f3f4f6; color: #6b7280; }

/* Inline edit */
.limit-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.limit-input {
  width: 60px;
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
}
.limit-input:focus { outline: none; border-color: #6366f1; }

/* Buttons */
button { cursor: pointer; border: none; border-radius: 8px; font-size: 0.875rem; font-weight: 500; transition: opacity 0.15s; }
button:hover { opacity: 0.85; }

.btn-primary { background: #6366f1; color: white; padding: 9px 18px; }
.btn-secondary { background: #f3f4f6; color: #374151; padding: 9px 18px; }
.btn-danger { background: #fee2e2; color: #dc2626; padding: 6px 12px; font-size: 0.8rem; }
.btn-warn { background: #fef3c7; color: #d97706; padding: 6px 12px; font-size: 0.8rem; }
.btn-info { background: #ede9fe; color: #6366f1; padding: 6px 12px; font-size: 0.8rem; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; background: #f3f4f6; color: #374151; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Inputs */
input[type="email"], input[type="password"], input[type="number"], input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: #6366f1; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: white;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.modal h3 { font-size: 1.1rem; margin-bottom: 4px; }
.modal label { font-size: 0.8rem; font-weight: 600; color: #555; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Error */
.error { color: #dc2626; font-size: 0.85rem; }

/* Fingerprint */
.fp { font-family: monospace; font-size: 0.8rem; color: #888; word-break: break-all; }

/* Scrollable tables */
.card { overflow-x: auto; }
