/* HBP Admin — minimal internal tool styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f4f6f9;
  --surface:  #ffffff;
  --border:   #dde1e7;
  --accent:   #1a73e8;
  --accent-h: #1558b0;
  --text:     #1f2937;
  --muted:    #6b7280;
  --danger:   #dc2626;
  --success:  #16a34a;
  --radius:   8px;
  --shadow:   0 1px 4px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 24px;
  box-shadow: var(--shadow);
}
nav .brand { font-weight: 700; font-size: 16px; color: var(--accent); flex: 1; }
nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
nav a:hover { color: var(--accent); }
#nav-admin-name { font-size: 13px; color: var(--muted); }
#nav-logout {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 12px;
  cursor: pointer; font-size: 13px; color: var(--text);
}
#nav-logout:hover { background: var(--bg); }

/* ─── Login card ──────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 360px;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .subtitle { color: var(--muted); font-size: 13px; margin-bottom: 28px; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-h); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }

/* ─── Alert ───────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-info  { background: #eff6ff; color: var(--accent); border: 1px solid #bfdbfe; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.page { padding: 24px; max-width: 1200px; margin: 0 auto; }
.page-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }

/* ─── Dashboard tabs ─────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  margin-bottom: -1px;
}
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Search bar ──────────────────────────────────────────────────────────── */
.search-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.audit-toolbar { justify-content: flex-start; }
.audit-toolbar label { margin: 0; }
.audit-toolbar select { width: auto; min-width: 140px; }
.table-scroll { overflow-x: auto; }
.audit-table { min-width: 720px; }
.audit-table .uuid {
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
}
.search-bar select { width: 160px; flex-shrink: 0; }
.search-bar input  { flex: 1; min-width: 180px; }

/* ─── Admin account management ───────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
.admin-card { padding: 18px; }
.admin-card h3 { font-size: 15px; margin-bottom: 14px; }
.admin-card .btn-primary { width: auto; }
.password-card { max-width: 360px; }
.password-note { color: var(--muted); font-size: 13px; margin: -4px 0 16px; }
.password-card small { display: block; color: var(--muted); margin-top: 5px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table td { white-space: nowrap; }
.admin-table td:nth-child(2) { white-space: normal; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn:disabled { cursor: not-allowed; opacity: .55; }

/* ─── Results table ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
td { padding: 10px 14px; vertical-align: top; }
td a { color: var(--accent); text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0;
}
.pagination button { min-width: 80px; }
.pagination .page-info { color: var(--muted); font-size: 13px; }

/* ─── User detail ─────────────────────────────────────────────────────────── */
.detail-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 16px;
}
.detail-header .avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; flex-shrink: 0;
}
.detail-header h2 { font-size: 18px; font-weight: 600; }
.detail-header .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.account-controls {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin: -6px 0 18px;
}
.account-actions {
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-blue   { background: #eff6ff; color: var(--accent); }
.badge-green  { background: #f0fdf4; color: var(--success); }
.badge-gray   { background: var(--bg); color: var(--muted); }
.badge-red    { background: #fef2f2; color: var(--danger); }

/* ─── Sections ────────────────────────────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.section-header {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
}
.section-header:hover { background: var(--bg); }
.section-header h3 { font-size: 14px; font-weight: 600; }
.section-header .count {
  background: var(--bg);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--muted);
}
.section-body { padding: 0; }
.section-body.collapsed { display: none; }

/* ─── Profile grid ────────────────────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
}
.profile-field {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.profile-field:last-child, .profile-field:nth-last-child(-n+2):nth-child(odd) {
  border-bottom: none;
}
.profile-field .key {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.profile-field .val { word-break: break-all; }

/* ─── Misc ────────────────────────────────────────────────────────────────── */
.empty { color: var(--muted); padding: 20px 16px; font-size: 13px; }
.back-link { color: var(--muted); font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.back-link:hover { color: var(--accent); }
.loading { color: var(--muted); padding: 40px; text-align: center; }

@media (max-width: 760px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-table { min-width: 640px; }
}
