/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #1a6fbf;
  --brand-dark:  #145399;
  --brand-light: #e8f1fb;
  --skill-bg:      #dff0e8;
  --skill-text:    #1a6640;
  --skill-sel:     #1a6640;
  --industry-bg:   #fde8cc;
  --industry-text: #7a4200;
  --industry-sel:  #7a4200;
  --language-bg:   #e0f0ff;
  --language-text: #1a4a8a;
  --language-sel:  #1a4a8a;
  --danger:      #c0392b;
  --danger-light:#fdecea;
  --surface:     #ffffff;
  --bg:          #f5f7fa;
  --border:      #d8dde6;
  --text:        #1c2333;
  --muted:       #6b7a99;
  --radius:      10px;
  --shadow:      0 2px 8px rgba(0,0,0,.10);
  --shadow-lg:   0 4px 20px rgba(0,0,0,.13);
}

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

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.site-header {
  background: var(--brand);
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  flex-wrap: wrap;
  gap: .5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.site-header .logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: inherit;
}
.logo-link:hover { opacity: .85; }

.header-logo {
  height: 34px;
  width: auto;
  background: #fff;
  border-radius: 5px;
  padding: 3px 6px;
  display: block;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.site-header nav a {
  color: rgba(255,255,255,.88);
  font-size: .9rem;
  font-weight: 500;
  padding: .35rem .75rem;
  border-radius: 6px;
  transition: background .15s;
}
.site-header nav a:hover, .site-header nav a.active {
  background: rgba(255,255,255,.18);
  text-decoration: none;
  color: #fff;
}

main { max-width: 1600px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

/* ── Page title ───────────────────────────────────────────────────────── */
.page-title { margin-bottom: 1.5rem; }
.page-title h1 { font-size: 1.7rem; font-weight: 700; }
.page-title p  { color: var(--muted); margin-top: .25rem; }

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-title-row h1 { font-size: 1.7rem; font-weight: 700; }
.page-title-row p  { color: var(--muted); margin-top: .25rem; }

/* ── Card action buttons (edit/delete on mentor cards) ─────────────────── */
.card-actions {
  display: flex;
  gap: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  margin-top: .25rem;
}
.card-btn { font-size: .8rem !important; padding: .3rem .7rem !important; }

/* ── Search bar ───────────────────────────────────────────────────────── */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}
.search-bar input {
  width: 100%;
  padding: .85rem 2.5rem .85rem 2.9rem;
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-bar input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,111,191,.15);
}
.search-bar .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 1.1rem;
}
.search-clear {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem .35rem;
  border-radius: 50%;
  line-height: 1;
}
.search-clear:hover { color: var(--text); background: var(--border); }

/* ── Classification segmented control ────────────────────────────────── */
.classification-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.classification-bar-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.class-seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.class-seg-btn {
  padding: .35rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text);
  transition: background .15s, color .15s;
}
.class-seg-btn + .class-seg-btn { border-left: 1px solid var(--border); }
.class-seg-btn:hover { background: var(--brand-light); color: var(--brand); }
.class-seg-btn.active { background: var(--brand); color: #fff; font-weight: 600; }

/* ── Filter panel ─────────────────────────────────────────────────────── */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.filter-panel .filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.filter-panel .filter-header h3 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.clear-btn {
  font-size: .8rem;
  color: var(--brand);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.clear-btn:hover { background: var(--brand-light); }

.filter-group { margin-bottom: 1rem; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .45rem;
}

/* ── Tags / chips ─────────────────────────────────────────────────────── */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .7rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 500;
  cursor: default;
  white-space: nowrap;
  transition: transform .1s;
}
.tag.skill     { background: var(--skill-bg);     color: var(--skill-text); }
.tag.industry  { background: var(--industry-bg);  color: var(--industry-text); }
.tag.language  { background: var(--language-bg);  color: var(--language-text); }

/* Clickable filter tags */
.tag.filter-tag {
  cursor: pointer;
  border: 2px solid transparent;
  user-select: none;
}

/* Compact filter tags in the search filter panel */
.filter-panel .tag.filter-tag {
  padding: .1rem .45rem;
  line-height: 1.3;
}
.filter-panel .tag-cloud { gap: .25rem; }
.tag.filter-tag:hover { filter: brightness(.93); transform: translateY(-1px); }
.tag.filter-tag.selected.skill {
  background: var(--skill-sel);
  color: #fff;
  border-color: var(--skill-sel);
}
.tag.filter-tag.selected.language {
  background: var(--language-sel);
  color: #fff;
  border-color: var(--language-sel);
}
.tag.filter-tag.selected.industry {
  background: var(--industry-sel);
  color: #fff;
  border-color: var(--industry-sel);
}

/* ── Results ──────────────────────────────────────────────────────────── */
.results-meta {
  font-size: .88rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.mentor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.mentor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.mentor-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.mentor-card .mentor-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.mentor-card .mentor-name-link {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mentor-card .mentor-name-link:hover { opacity: .8; }
.ext-link-icon {
  margin-left: .25rem;
  vertical-align: middle;
  opacity: .7;
}

.mentor-card .mentor-contact {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .87rem;
  color: var(--muted);
}
.mentor-card .mentor-contact span {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.mentor-card .mentor-contact a { color: var(--brand); }
.mentor-card .mentor-contact .ci { display: inline-block; width: 1.25em; text-align: center; flex-shrink: 0; }

.mentor-card .mentor-bio {
  font-size: .88rem;
  color: #444;
  line-height: 1.55;
}

.mentor-card .tag-section { display: flex; flex-direction: column; gap: .45rem; }
.mentor-card .tag-section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ── Loading state ────────────────────────────────────────────────────── */
.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.loading-state p { font-size: 1rem; margin-top: .5rem; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: 1rem; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: filter .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.92); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--brand-light); color: var(--brand); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-ghost     { background: transparent; color: var(--muted); border: 1px solid var(--border); }

/* ── Admin ────────────────────────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
}
.card-header h2 { font-size: 1rem; font-weight: 700; }
.card-body { padding: 1.25rem; }

/* ── Table ────────────────────────────────────────────────────────────── */
.mentor-table { width: 100%; border-collapse: collapse; }
.mentor-table th, .mentor-table td {
  padding: .65rem .85rem;
  text-align: left;
  font-size: .88rem;
}
.mentor-table th {
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.mentor-table td { border-bottom: 1px solid var(--border); vertical-align: top; }
.mentor-table tr:last-child td { border-bottom: none; }
.mentor-table tr:hover td { background: var(--bg); }
.mentor-table .actions { display: flex; gap: .4rem; }
.mentor-table .tag-wrap { display: flex; flex-wrap: wrap; gap: .3rem; max-width: 260px; }

/* ── Form ─────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}
.form-grid .full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
}
.form-group input,
.form-group textarea {
  padding: .55rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: .92rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background: var(--surface);
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,111,191,.12);
}
.form-group textarea { resize: vertical; min-height: 80px; }

.tag-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-picker .tag.filter-tag { border-width: 2px; }

.form-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Modal overlay ────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
  padding: .25rem;
  border-radius: 5px;
  line-height: 1;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.25rem; }

/* ── Tag manager ──────────────────────────────────────────────────────── */
.tag-manager-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
}
.tag-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .75rem; }
.tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem .6rem;
  border-radius: 6px;
  background: var(--bg);
}
.tag-item .tag { cursor: default; }
.tag-item .del-tag {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 5px;
  border-radius: 4px;
}
.tag-item .del-tag:hover { color: var(--danger); background: var(--danger-light); }

.add-tag-form { display: flex; gap: .5rem; margin-top: .75rem; }
.add-tag-form input {
  flex: 1;
  padding: .45rem .7rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: .88rem;
  outline: none;
}
.add-tag-form input:focus { border-color: var(--brand); }

/* ── Import ───────────────────────────────────────────────────────────── */
.import-form { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.import-summary { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .9rem; font-weight: 600; }
.import-stat { padding: .3rem .7rem; border-radius: 6px; }
.import-stat.success { background: #d4edda; color: #155724; }
.import-stat.skipped { background: #fff3cd; color: #856404; }
.import-stat.error   { background: #f8d7da; color: #721c24; }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 500;
}
.toast {
  background: #2d3748;
  color: #fff;
  padding: .7rem 1.1rem;
  border-radius: 8px;
  font-size: .88rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
}
.toast.success { background: #276749; }
.toast.error   { background: var(--danger); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .tag-manager-grid { grid-template-columns: 1fr; }
  .mentor-table .hide-mobile { display: none; }
  .users-table .hide-mobile { display: none; }

  .site-header {
    padding: .5rem .75rem;
    gap: .35rem;
  }
  .header-logo { height: 26px; }
  .logo-text { font-size: .78rem; white-space: normal; }
  .user-name { display: none; }
  .site-header nav a { padding: .3rem .5rem; font-size: .82rem; }
}

/* ── Login page ───────────────────────────────────────────────────────── */
.login-page { background: var(--bg); }

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 2rem 1rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.login-subtitle {
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.5;
}

.login-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #f5c6c2;
  border-radius: 7px;
  padding: .75rem 1rem;
  font-size: .88rem;
  width: 100%;
  text-align: left;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: .65rem 1.4rem;
  font-size: .95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin-top: .5rem;
}

.google-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 6px rgba(0,0,0,.14);
  text-decoration: none;
  color: #3c4043;
}

.google-icon { flex-shrink: 0; }

/* ── User menu in header ──────────────────────────────────────────────── */
.user-menu {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}


.user-name {
  color: rgba(255,255,255,.92);
  font-size: .85rem;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* Role badge in header */
.site-header .role-badge {
  background: rgba(255,255,255,.2);
  color: #fff;
}

/* Role badge colors (outside header, e.g. users page) */
.role-badge.role-viewer { background: #e9ecef; color: #495057; }
.role-badge.role-editor { background: var(--brand-light); color: var(--brand); }
.role-badge.role-admin  { background: #fff3cd; color: #856404; }

/* ── View-as selector (admin only) ───────────────────────────────────── */
.view-as-select {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 6px;
  padding: .25rem .5rem;
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}
.view-as-select:focus { border-color: rgba(255,255,255,.8); }
.view-as-select option { background: var(--brand-dark); color: #fff; }

/* ── Impersonation banner ─────────────────────────────────────────────── */
.impersonation-banner {
  background: #fff3cd;
  color: #856404;
  border-bottom: 2px solid #ffc107;
  padding: .55rem 1.25rem;
  font-size: .88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  position: sticky;
  top: 60px;
  z-index: 99;
}
.imp-reset-btn {
  background: #856404;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: .25rem .7rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.imp-reset-btn:hover { background: #6d5203; }

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,.5);
  color: rgba(255,255,255,.9);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.btn-logout:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* ── Users table ──────────────────────────────────────────────────────── */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td {
  padding: .65rem .85rem;
  text-align: left;
  font-size: .88rem;
}
.users-table th {
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.users-table td { border-bottom: 1px solid var(--border); vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--bg); }

.status-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.status-badge.active   { background: #d4edda; color: #155724; }
.status-badge.inactive { background: #f8d7da; color: #721c24; }

.you-badge {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 400;
}

.role-select {
  padding: .3rem .5rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.role-select:focus { border-color: var(--brand); }

/* ── Pagination ───────────────────────────────────────────────────────── */
#pagination { margin: 1.5rem 0 2rem; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 .65rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
}
.page-btn:hover:not(:disabled):not(.active) {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
}
.page-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  cursor: default;
}
.page-btn:disabled {
  opacity: .38;
  cursor: default;
}
.page-nav { font-size: .82rem; }
.page-ellipsis {
  min-width: 28px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  line-height: 36px;
  display: inline-block;
}

/* ── Audit log ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.audit-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.audit-table th {
  padding: .6rem .85rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.audit-table td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.4;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover td { background: var(--bg); }

.audit-when   { white-space: nowrap; color: var(--muted); font-size: .83rem; }
.audit-email  { font-size: .78rem; color: var(--muted); }
.audit-detail { font-size: .82rem; color: var(--muted); }

.entity-type {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 4px;
  padding: .05rem .35rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: .25rem;
}

.action-badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-create { background: #d4edda; color: #155724; }
.badge-update { background: var(--brand-light); color: var(--brand); }
.badge-delete { background: var(--danger-light); color: var(--danger); }

/* ── Mentor card — updated schema ────────────────────────────────────── */
.mentor-name-row {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}

.mentor-status {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-active      { background: #d4edda; color: #155724; }
.status-inactive    { background: #f8d7da; color: #721c24; }
.status-provisional { background: #fff3cd; color: #856404; }

.mentor-class {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--language-bg);
  color: var(--language-text);
}

/* ── Form — City / State / Zip row ───────────────────────────────────── */
.form-city  { flex: 1 1 160px; }
.form-state { flex: 0 0 70px;  min-width: 60px; }
.form-zip   { flex: 0 0 100px; min-width: 80px; }

/* ── Results toolbar (count + view toggle) ───────────────────────────── */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  gap: 1rem;
}

.view-toggle { display: flex; gap: .3rem; }

.view-toggle-btn {
  padding: .35rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: .84rem;
  font-family: inherit;
  line-height: 1.2;
  transition: background .15s, color .15s;
}
.view-toggle-btn:hover  { background: var(--bg); }
.view-toggle-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Detail (spreadsheet) view ───────────────────────────────────────── */
.detail-top-scroll {
  overflow-x: scroll;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
}
.detail-top-scroll-spacer { height: 1px; }

.detail-scroll {
  overflow-x: scroll;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.detail-table {
  /* No width:100% — let fixed columns determine width so container scrolls */
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .85rem;
  white-space: nowrap;
}

.detail-table thead th {
  padding: .5rem .65rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.detail-table thead th:last-child { border-right: none; }

td.dtd {
  padding: .2rem .35rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-table tbody tr:last-child td { border-bottom: none; }
.detail-table tbody tr:hover td { background: var(--bg); }
td.dtd:last-child { border-right: none; }

/* Editable cell inputs */
.cell-input {
  display: block;
  width: 100%;
  min-width: 90px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: .22rem .4rem;
  font-size: .85rem;
  font-family: inherit;
  color: var(--text);
  box-sizing: border-box;
}
.cell-input:hover { border-color: var(--border); background: var(--surface); }
.cell-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--brand-light);
}

/* Narrow fields */
.cell-input[data-field="state"] { min-width: 36px; max-width: 48px; }
.cell-input[data-field="zip"]   { min-width: 72px; max-width: 90px; }
.cell-input[data-field="phone"] { min-width: 130px; }

/* Action column */
.detail-actions {
  display: flex;
  gap: .35rem;
  align-items: center;
  padding: .2rem .5rem !important;
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -2px 0 6px rgba(0,0,0,.06);
}
.detail-table tbody tr:hover .detail-actions { background: var(--bg); }

/* Save button hidden until row is dirty */
.row-save-hidden { display: none !important; }

/* Engage URL link in grid action column */
.engage-link {
  font-weight: 700;
  font-size: .85rem;
  color: #1a6fbf;
  text-decoration: none;
  white-space: nowrap;
}
.engage-link:hover { text-decoration: underline; }
.engage-link.engage-link-empty { color: var(--border); cursor: default; }

/* Small button variant */
.btn-sm { padding: .25rem .65rem; font-size: .78rem; }

/* ── Admin page sections ─────────────────────────────────────────────── */
.admin-section { margin-bottom: 2.5rem; }
.section-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .2rem;
}
.section-sub {
  font-size: .88rem;
  color: var(--muted);
  margin: 0 0 .85rem;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  font-size: .75rem;
  color: var(--muted);
}

/* ── Sortable columns ────────────────────────────────────────────────── */
.detail-table .dth { position: relative; padding-right: 1.4rem; }
.detail-table .sortable { cursor: pointer; user-select: none; }
.detail-table .sortable:hover { background: var(--bg); }
.sort-icon { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); font-size: .65rem; color: var(--muted); opacity: .45; }
.detail-table .sort-active .sort-icon { color: var(--brand); opacity: 1; }

/* ── Column resize handle ─────────────────────────────────────────────── */
.col-resize-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 2; }
.dth:hover .col-resize-handle { background: var(--brand); opacity: .35; }

/* ── View modal content ───────────────────────────────────────────────── */
.view-fields { margin-bottom: .75rem; }
.view-field { display: flex; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.view-field:last-child { border-bottom: none; }
.view-label { flex: 0 0 110px; font-weight: 600; color: var(--muted); font-size: .82rem; padding-top: .05rem; }
.view-val { flex: 1; color: var(--text); }
.view-tags { margin-top: .75rem; }
.view-modal-actions { display: flex; gap: .75rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ── Clickable detail rows ────────────────────────────────────────────── */
.detail-table tbody tr { cursor: pointer; }
.detail-table tbody tr:hover td { background: #f0f4ff; }
