/* ============================================================
   TJU Gate Manager v2 — Shared Styles (Redesigned)
   Brand: Tianjin University — refined, leadership-grade
   ============================================================ */

:root {
  /* Brand */
  --primary: #1a3a6b;
  --primary-light: #264a85;
  --primary-hover: #122850;
  --primary-soft: #e8edf5;
  --accent: #c41e3a;
  --accent-light: #e8485e;
  --accent-soft: #fde8ec;

  /* Surfaces */
  --bg-root: #f0f2f7;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbfd;
  --bg-input: #f4f5f9;
  --bg-sidebar: #0f1d38;

  /* Text */
  --text: #1a1a2e;
  --text-dim: #525a6e;
  --text-soft: #8b92a5;
  --text-inverse: #e8ecf4;

  /* Borders */
  --border: #e2e5ee;
  --border-strong: #cdd1dc;

  /* Semantic */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info: #6366f1;
  --info-soft: #eef2ff;

  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.04);
  --shadow-xl: 0 16px 40px rgba(0,0,0,.11), 0 4px 10px rgba(0,0,0,.04);

  /* Transitions */
  --transition: .2s cubic-bezier(.4,0,.2,1);
  --transition-fast: .12s cubic-bezier(.4,0,.2,1);
  --transition-slow: .35s cubic-bezier(.4,0,.2,1);

  /* Layout */
  --sidebar-width: 240px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "SimHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg-root);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-light); }

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8cdd8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8aebc; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  z-index: 100;
  overflow-y: auto;
  display: flex; flex-direction: column;
}

.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  font-size: 15px; font-weight: 700; letter-spacing: .5px;
  color: #fff !important;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 4px;
}
.sb-brand i { font-size: 20px; opacity: .85; }
.sb-brand span { white-space: nowrap; }

.sb-nav { padding: 0 10px; flex: 1; }

.sb-group { margin-bottom: 2px; }
.sb-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.45);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  user-select: none;
}
.sb-group-header:hover { color: rgba(255,255,255,.7); background: rgba(255,255,255,.04); }
.sb-group-header i { font-size: 13px; }
.sb-chevron { margin-left: auto; font-size: 10px; transition: transform var(--transition-fast); }

.sb-group-body { padding-left: 4px; }

.sb-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  font-size: 13px; color: rgba(255,255,255,.6);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none !important;
}
.sb-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.sb-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99,102,241,.35), rgba(99,102,241,.15));
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.sb-item i { font-size: 14px; width: 18px; text-align: center; }

.sb-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.sb-section-title {
  padding: 6px 12px 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
}

/* ============================================================
   Content Area
   ============================================================ */
.main {
  margin-left: var(--sidebar-width);
  padding: 28px 32px;
  min-height: 100vh;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.page-title {
  font-size: 22px; font-weight: 800; letter-spacing: -.3px;
  color: var(--text);
}
.page-subtitle { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* ============================================================
   Cards
   ============================================================ */
.tju-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
}
.tju-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.tju-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
}
.tju-card-body { padding: 16px 18px; }
.tju-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
}

/* ============================================================
   Buttons
   ============================================================ */
.tju-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 600; line-height: 1.4;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.tju-btn:active { transform: scale(.97); }

.tju-btn-primary {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}
.tju-btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.tju-btn-accent {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}
.tju-btn-accent:hover { background: var(--accent-light); }

.tju-btn-outline {
  background: #fff; color: var(--text-dim);
  border-color: var(--border-strong);
}
.tju-btn-outline:hover { background: var(--bg-input); border-color: var(--text-soft); color: var(--text); }

.tju-btn-ghost {
  background: transparent; color: var(--text-dim);
  border-color: transparent;
}
.tju-btn-ghost:hover { background: var(--bg-input); color: var(--text); }

.tju-btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 4px; }
.tju-btn-lg { padding: 10px 22px; font-size: 15px; }

.tju-btn-danger {
  background: var(--danger); color: #fff;
  border-color: var(--danger);
}
.tju-btn-danger:hover { background: #dc2626; }

.tju-btn-success {
  background: var(--success); color: #fff;
}
.tju-btn-success:hover { background: #059669; }

/* ============================================================
   Form Controls
   ============================================================ */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="tel"],
select,
textarea {
  padding: 8px 12px;
  font-size: 13px; font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,58,107,.08);
  background: #fff;
}
input::placeholder { color: var(--text-soft); }

select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b92a5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  padding-right: 30px;
}

label { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 4px; display: block; }

.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* Checkbox / Toggle */
input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px; height: 16px; cursor: pointer;
}

/* ============================================================
   Badges & Tags
   ============================================================ */
.tju-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  font-size: 11px; font-weight: 600; line-height: 1.5;
  border-radius: 100px;
  white-space: nowrap;
}
.tju-badge-primary { background: var(--primary-soft); color: var(--primary); }
.tju-badge-success { background: var(--success-soft); color: #065f46; }
.tju-badge-warning { background: var(--warning-soft); color: #92400e; }
.tju-badge-danger { background: var(--danger-soft); color: #991b1b; }
.tju-badge-info { background: var(--info-soft); color: var(--info); }
.tju-badge-accent { background: var(--accent-soft); color: var(--accent); }

.tju-tag {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  border-radius: 3px;
  text-transform: uppercase;
}
.tju-tag-white { background: #d1fae5; color: #065f46; }
.tju-tag-black { background: #fee2e2; color: #991b1b; }
.tju-tag-fuzzy { background: #fef3c7; color: #92400e; }
.tju-tag-none { background: #f1f5f9; color: #64748b; }

/* ============================================================
   Tables
   ============================================================ */
table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 10px 14px;
  text-align: left; font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-soft);
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-dim);
}
tbody tr:hover td { background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  animation: fadeIn .15s ease;
}
.modal-overlay.show { display: flex; }

.tju-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 90%; max-width: 640px; max-height: 85vh;
  overflow-y: auto;
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
}
.tju-modal-lg { max-width: 800px; }
.tju-modal-sm { max-width: 420px; }

.tju-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.tju-modal-header h3 { font-size: 16px; font-weight: 800; }
.tju-modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--bg-input);
  font-size: 16px; color: var(--text-soft);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.tju-modal-close:hover { background: #e2e5ee; color: var(--text); }

.tju-modal-body { padding: 20px; }
.tju-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ============================================================
   Stats Row
   ============================================================ */
.stats-row {
  display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px;
}
.stat-card {
  flex: 1; min-width: 150px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  transition: all var(--transition);
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; flex-shrink: 0;
}
.stat-num { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--text-soft); margin-top: 2px; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

.animate-fade-in { animation: fadeIn .25s ease; }
.animate-slide-up { animation: slideUp .3s cubic-bezier(.4,0,.2,1); }
.animate-scale-in { animation: scaleIn .2s cubic-bezier(.4,0,.2,1); }

/* Stagger children */
.stagger > * { opacity: 0; animation: slideUp .35s cubic-bezier(.4,0,.2,1) forwards; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; }
.stagger > *:nth-child(8) { animation-delay: .30s; }
.stagger > *:nth-child(9) { animation-delay: .34s; }
.stagger > *:nth-child(10) { animation-delay: .38s; }

/* ============================================================
   Utility
   ============================================================ */
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-soft); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* ============================================================
   Pass Record Cards (通行记录)
   ============================================================ */

#passList {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (max-width: 768px) {
  #passList { grid-template-columns: 1fr; }
}

.pass-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 16px;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
  min-height: 62px;
}
.pass-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.pass-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border);
  transition: background var(--transition);
}
.pass-card:hover::before { background: var(--primary); }
.pass-card.pass-unread { background: #fafcff; }
.pass-card.pass-unread::before { background: var(--info); }

.pass-card-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.pass-card-icon.in { background: var(--success-soft); color: var(--success); }
.pass-card-icon.out { background: var(--info-soft); color: var(--info); }
.pass-card-icon.dup { background: var(--warning-soft); color: var(--warning); }

.pass-card-info { flex: 1; min-width: 0; }
.pass-card-plate {
  font-size: 16px; font-weight: 800; letter-spacing: 1px;
  color: var(--text);
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.pass-card-meta {
  font-size: 11px; color: var(--text-soft); margin-top: 2px;
  display: flex; gap: 8px; flex-wrap: wrap;
}

.pass-card-time {
  font-size: 11px; color: var(--text-soft);
  white-space: nowrap; text-align: right;
}

.pass-card-person {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: #f8fafc;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.pass-card-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.pass-new-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; font-weight: 800; letter-spacing: .5px;
  background: var(--danger); color: #fff;
  padding: 2px 7px; border-radius: 3px;
  text-transform: uppercase;
  animation: pulse 2s infinite;
}

.pass-dup-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  background: var(--warning-soft); color: #92400e;
  padding: 1px 6px; border-radius: 3px;
  margin-left: 4px;
}



/* ============================================================
   Personnel Cards (.p-* classes used by personnel.js)
   ============================================================ */

#personnelList {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1000px) {
  #personnelList { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  #personnelList { grid-template-columns: 1fr; }
}

.p-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 0;
}
.p-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.p-card-top {
  padding: 16px 18px 12px;
  display: flex; align-items: center; gap: 12px;
}
.p-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; flex-shrink: 0;
}
.p-card-header { flex: 1; min-width: 0; }
.p-name {
  font-size: 16px; font-weight: 800; color: var(--text);
}
.p-dept {
  font-size: 11px; color: var(--text-soft); margin-top: 1px;
}
.p-status {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px;
  white-space: nowrap; flex-shrink: 0;
}
.p-status-active { background: var(--success-soft); color: #065f46; }
.p-status-left { background: var(--danger-soft); color: #991b1b; }
.p-status-temp { background: var(--warning-soft); color: #92400e; }

.p-card-body {
  padding: 0 18px 14px;
  display: flex; flex-direction: column; gap: 5px;
}
.p-info-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-dim);
}
.p-info-row i { color: var(--text-soft); font-size: 13px; width: 16px; text-align: center; }
.p-info-row span { font-weight: 600; }
.p-car-row span {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 100px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.p-car-row span:hover { background: #d0daf0; }

.p-card-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  text-align: right;
}
.p-date-badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700;
}
.p-date-ok { background: #d1fae5; color: #065f46; }
.p-date-soon { background: #fee2e2; color: #991b1b; }
.p-date-expired { background: #1e293b; color: #fff; }

/* ============================================================
   Personnel Cards (备案管理)
   ============================================================ */
.personnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.personnel-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: all var(--transition);
}
.personnel-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.personnel-card-top {
  padding: 16px 18px 12px;
  display: flex; align-items: center; gap: 12px;
}
.personnel-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; flex-shrink: 0;
}
.personnel-name {
  font-size: 16px; font-weight: 800; color: var(--text);
}
.personnel-dept {
  font-size: 11px; color: var(--text-soft); margin-top: 1px;
}

.personnel-card-body {
  padding: 0 18px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.personnel-field {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.personnel-field-key { color: var(--text-soft); }
.personnel-field-val { color: var(--text-dim); font-weight: 600; }

.personnel-card-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  display: flex; gap: 6px; justify-content: flex-end;
  background: #fafbfd;
}

.personnel-plate {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 100px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.personnel-plate:hover { background: #d0daf0; }

/* ============================================================
   White/Black List Cards
   ============================================================ */
.wb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.wb-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}
.wb-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.wb-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.wb-card.white::before { background: var(--success); }
.wb-card.black::before { background: var(--danger); }

.wb-card-body { padding: 16px 18px; }
.wb-card-plate {
  font-size: 18px; font-weight: 800; letter-spacing: 1px;
  margin-bottom: 8px;
}
.wb-card-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 3px 0;
}
.wb-card-row .k { color: var(--text-soft); }
.wb-card-row .v { color: var(--text-dim); font-weight: 600; }

/* ============================================================
   Pass Detail Modal
   ============================================================ */
.pdm-layout { display: flex; gap: 20px; }
@media(max-width:600px){ .pdm-layout { flex-direction: column; } }
.pdm-info { flex: 1; min-width: 0; }
.pdm-side { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }

.pdm-table { width: 100%; }
.pdm-table td { padding: 7px 0; font-size: 12px; border-bottom: 1px solid #f8fafc; }
.pdm-td-k { color: var(--text-soft); width: 70px; font-weight: 600; }
.pdm-td-v { color: var(--text); font-weight: 600; }

.pdm-img-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f8fafc;
}
.pdm-img-wrap img { width: 100%; display: block; cursor: pointer; }

.pdm-person-panel {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
}

.pdm-person-full { display: flex; gap: 10px; }
.pdm-p-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.pdm-p-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.pdm-p-row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; padding: 2px 0;
}
.pdm-p-row span:first-child { color: var(--text-soft); }
.pdm-p-row span:last-child { color: var(--text-dim); font-weight: 600; }

/* ============================================================
   Filter Bar
   ============================================================ */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}
.filter-bar input,
.filter-bar select {
  height: 34px;
}
.filter-bar label {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-dim); cursor: pointer;
  margin: 0;
}

/* ============================================================
   SQL Result Cards
   ============================================================ */
.sql-result-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
  background: #fff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.sql-result-table th {
  padding: 8px 12px; text-align: left;
  font-size: 11px; font-weight: 700;
  background: var(--primary); color: #fff;
}
.sql-result-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #f1f5f9;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.sql-result-table tr:hover td { background: #f8fafc; }


/* Pass chain button */
.pass-chain-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  border: 1px solid #e2e8f0; background: #fff;
  color: #6366f1; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.pass-chain-btn:hover {
  background: #eef2ff; border-color: #c7d2fe;
}



/* ============================================================
   Pass Record Card Internals (pc-*) — used by pass.js
   ============================================================ */
.pc-left { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.pc-mid { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 11px; }
.pc-right { display: none; }
.pc-time { font-size: 11px; color: #8b92a5; white-space: nowrap; display: block; margin-top: 3px; }

.pc-plate {
  font-size: 16px; font-weight: 800; letter-spacing: 1px;
  color: #1a1a2e;
}
.plate-green { color: #065f46; }
.plate-red { color: #991b1b; }
.pc-plate-fuzzy { font-size: 11px; color: #8b92a5; margin-left: 4px; }
.plate-fuzzy-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.pc-person {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: #f4f5f9;
  border-radius: 100px; font-size: 11px; font-weight: 600;
  color: #525a6e; white-space: nowrap; flex-shrink: 0;
}
.pc-person-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, #1a3a6b, #6366f1);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.pc-person-name { font-weight: 600; }

.wb-tag {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.wb-white { background: #d1fae5; color: #065f46; }
.wb-black { background: #fee2e2; color: #991b1b; }
.wb-fuzzy { background: #fef3c7; color: #92400e; }
.wb-none { background: #f1f5f9; color: #64748b; }

.new-badge {
  position: absolute; top: 6px; right: 8px;
  font-size: 9px; font-weight: 800; letter-spacing: .5px;
  background: #ef4444; color: #fff;
  padding: 2px 7px; border-radius: 3px;
  animation: pulse 2s infinite;
}
.dup-tag {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 700;
  background: #fef3c7; color: #92400e;
  margin-left: 4px;
}
.io-tag { font-weight: 700; }
.clr-tag { font-size: 11px; color: #8b92a5; }
.evt-tag { font-size: 11px; color: #8b92a5; }
.dup-tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }

/* ============================================================
   White/Black List Card Internals (wb-*) — used by wb.js
   ============================================================ */
.wb-card2 {
  background: #fff; border-radius: 10px; border: 1px solid #e2e5ee;
  overflow: hidden; transition: all .18s; margin-bottom: 10px;
}
.wb-card2:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.wb-strip {
  height: 3px;
}
.wb-strip.white-strip { background: #10b981; }
.wb-strip.black-strip { background: #ef4444; }

.wb-body { padding: 14px 18px; }
.wb-plate2 { font-size: 18px; font-weight: 800; letter-spacing: 1px; margin-bottom: 6px; }
.wb-line { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }
.wb-line .k { color: #8b92a5; }
.wb-line .v { color: #525a6e; font-weight: 600; }
.wb-remark2 { font-size: 11px; color: #8b92a5; margin-top: 4px; }
.wb-badge {
  display: inline-block; padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 700;
}
.wb-white-badge { background: #d1fae5; color: #065f46; }
.wb-black-badge { background: #fee2e2; color: #991b1b; }
.wb-actions2 { display: flex; gap: 6px; margin-top: 10px; }
.wb-del-btn {
  padding: 4px 12px; font-size: 11px; font-weight: 600;
  border: 1px solid #fecaca; border-radius: 6px;
  background: #fef2f2; color: #dc2626; cursor: pointer;
}
.wb-del-btn:hover { background: #fee2e2; }

.wb-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
}

/* ============================================================
   Personnel Form (pf-*) — used by personnel.js
   ============================================================ */
.pf-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.pf-field label {
  display: block; font-size: 11px; font-weight: 700;
  color: #525a6e; margin-bottom: 4px;
}
.pf-field input, .pf-field select {
  width: 100%; padding: 7px 10px; font-size: 12px;
  border: 1px solid #e2e5ee; border-radius: 6px;
  background: #f4f5f9; outline: none;
}
.pf-field input:focus, .pf-field select:focus {
  border-color: #1a3a6b; background: #fff;
}


/* Stay duration badge */
.stay-dur {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 700;
  background: #fef3c7; color: #92400e;
}
/* Today count badge */
.today-count {
  display: inline-block;
  padding: 2px 8px; border-radius: 100px;
  font-size: 10px; font-weight: 700;
  background: #e0e7ff; color: #4338ca;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  :root { --sidebar-width: 200px; }
  .main { padding: 16px; }
  .stats-row { gap: 8px; }
  .stat-card { min-width: 120px; padding: 12px 14px; }
  .stat-num { font-size: 20px; }
}

@media (max-width: 540px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
}

/* Inline copy button on pass cards */
.pc-copy-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  margin-left: 6px;
  transition: all .15s;
  flex-shrink: 0;
}
.pc-copy-inline:hover {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}
