/* ── Design tokens (from dc26.dcedit.org) ───────────────────────── */
:root {
  --warm-bg:      #f7f3ec;   /* body background — warm parchment       */
  --sand:         #ede7da;   /* card/section bg — slightly darker       */
  --sand-border:  #ddd6c8;   /* borders                                  */
  --crimson:      #5b0f1a;   /* primary brand color                      */
  --crimson-dark: #3d0a11;   /* hover / pressed                          */
  --gold:         #c6a75e;   /* accent — buttons, highlights             */
  --gold-dark:    #a8883e;   /* gold hover                               */
  --dark-navy:    #1c1c2e;   /* dark sections, footer                    */
  --text-primary: #3a3028;   /* main body text                           */
  --text-muted:   #7a6a5a;   /* secondary text                           */
  --text-light:   #a89888;   /* placeholder / disabled                   */
  --white:        #ffffff;
  --error:        #c0392b;
  --success:      #27ae60;
}

/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--warm-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }

/* ── App shell ──────────────────────────────────────────────────── */
.view { display: none; min-height: 100vh; }

/* ── Toast notification ─────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--dark-navy); color: var(--warm-bg);
  padding: 12px 22px; border-radius: 30px;
  font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
  transition: transform 0.3s ease; z-index: 9999; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--error); }

/* ── Navigation bar ─────────────────────────────────────────────── */
#main-nav {
  display: none;
  position: sticky; top: 0; z-index: 200;
  background: var(--crimson);
  align-items: center; justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  /* needed so .nav-dropdown positions relative to this bar */
  overflow: visible;
}
.nav-brand { color: var(--warm-bg); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; opacity: 0.92; }
.nav-actions { display: flex; gap: 6px; align-items: center; }
.nav-btn {
  background: rgba(247,243,236,0.15); border: none;
  color: var(--warm-bg); font-size: 0.75rem; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background 0.15s;
}
.nav-btn:hover, .nav-btn.active { background: rgba(247,243,236,0.28); }
.nav-btn .icon { font-size: 1rem; }

/* Action buttons in nav — match original colours */
.nav-action-btn.btn-edit    { background: rgba(247,243,236,0.22); }
.nav-action-btn.btn-qr-show { background: rgba(247,243,236,0.12); }
.nav-action-btn.btn-qr-scan { background: rgba(247,243,236,0.12); color: var(--warm-bg); }

/* Hamburger button */
.nav-hamburger-btn { font-size: 1.15rem; padding: 6px 10px; letter-spacing: 0; }

/* Hamburger dropdown */
.nav-dropdown {
  position: absolute; top: 52px; right: 0;
  background: var(--crimson);
  border-top: 1px solid rgba(247,243,236,0.2);
  border-radius: 0 0 0 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  z-index: 199; min-width: 160px;
  display: flex; flex-direction: column; padding: 6px 0;
}
.nav-menu-item {
  background: none; border: none; color: var(--warm-bg);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  padding: 11px 18px; text-align: left;
  display: flex; align-items: center; gap: 8px;
  transition: background 0.12s;
}
.nav-menu-item:hover, .nav-menu-item.active { background: rgba(247,243,236,0.18); }
.nav-menu-item .icon { font-size: 1rem; }

/* ── Page header ────────────────────────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--crimson) 0%, #8b1a2b 100%);
  color: var(--warm-bg); padding: 18px 16px 14px; text-align: center;
}
.page-header h1 { font-size: 1.25rem; font-weight: 700; }
.page-header p  { font-size: 0.8rem; opacity: 0.82; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN VIEW
═══════════════════════════════════════════════════════════════ */
#view-login {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--crimson) 0%, #8b1a2b 45%, var(--dark-navy) 100%);
  min-height: 100vh; padding: 24px 20px;
}
.login-box {
  background: var(--warm-bg); border-radius: 20px;
  padding: 32px 28px; width: 100%; max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo .crest { font-size: 2.8rem; }
.login-logo h2 { font-size: 1.1rem; font-weight: 700; color: var(--crimson); margin-top: 8px; }
.login-logo p  { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.login-box label {
  display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px;
}
.login-box input[type="text"],
.login-box input[type="email"] {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--sand-border); border-radius: 10px;
  font-size: 1rem; outline: none; margin-bottom: 14px;
  background: var(--white);
  transition: border-color 0.15s;
}
.login-box input:focus { border-color: var(--gold); }
.login-submit {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--crimson), #8b1a2b);
  color: var(--warm-bg); border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 4px;
  transition: opacity 0.15s;
}
.login-submit:hover { opacity: 0.88; }
.login-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.login-error { color: var(--error); font-size: 0.82rem; margin-top: 10px; text-align: center; min-height: 18px; }
.login-lockout {
  display: none; color: var(--error); font-size: 0.82rem;
  text-align: center; margin-top: 10px; font-weight: 600;
}
.login-hint { font-size: 0.78rem; color: var(--text-muted); text-align: center; margin-top: 10px; line-height: 1.5; }
.guest-hint { font-size: 0.76rem; }

/* ── Autocomplete dropdown ──────────────────────────────────── */
.ac-wrap { position: relative; }
.ac-wrap input { margin-bottom: 0 !important; }
.ac-list {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--white); border: 1.5px solid var(--gold);
  border-top: none; border-radius: 0 0 10px 10px;
  max-height: 220px; overflow-y: auto; list-style: none;
  z-index: 50; box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  margin: 0 0 14px; padding: 4px 0;
}
.ac-item {
  padding: 10px 14px; font-size: 0.95rem; cursor: pointer;
  color: var(--text-primary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; transition: background 0.1s;
}
.ac-item:hover, .ac-item-active { background: var(--sand); color: var(--crimson); }

/* ── WhatsApp help link ─────────────────────────────────────── */
.login-wa-help { margin-top: 18px; text-align: center; }
.login-wa-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--text-muted); text-decoration: none;
  padding: 7px 14px; border-radius: 20px; border: 1px solid var(--sand-border);
  transition: background 0.15s, color 0.15s;
}
.login-wa-link:hover { background: #e7f9ef; color: #128c3a; border-color: #a8dfba; }
.wa-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   HOME VIEW  (greeting + controls + directory grid)
═══════════════════════════════════════════════════════════════ */
.greeting-bar {
  background: var(--sand); border-bottom: 1px solid var(--sand-border);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.greeting-text { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.greeting-text span { color: var(--crimson); }
.action-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 10px; border: none;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.action-btn:hover { opacity: 0.82; }
.btn-edit    { background: var(--crimson); color: var(--warm-bg); }
.btn-qr-show { background: var(--dark-navy); color: var(--warm-bg); }
.btn-qr-scan { background: var(--gold); color: var(--dark-navy); }
.btn-history { background: var(--sand-border); color: var(--text-primary); }

/* Controls (search + filters) */
.controls {
  background: var(--warm-bg); border-bottom: 1px solid var(--sand-border);
  padding: 0 16px;
  position: sticky; top: 52px; z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Collapsible toggle button */
.controls-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: none; border-radius: 0;
  padding: 10px 0;
  font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
  cursor: pointer; text-align: left;
}
.controls-toggle-label { flex: 1; }
.controls-chevron {
  font-size: 0.75rem; color: var(--text-muted);
  display: inline-block; transition: transform 0.2s;
}
.controls-toggle[aria-expanded="false"] .controls-chevron { transform: rotate(-90deg); }

/* Active filter count badge */
.filter-badge {
  background: var(--crimson); color: var(--warm-bg);
  font-size: 0.68rem; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}

/* Collapsible body */
.controls-body {
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.25s ease;
  padding-bottom: 8px;
}
.controls-body.collapsed { max-height: 0; padding-bottom: 0; }

/* Search input */
#dir-search {
  width: 100%; padding: 9px 14px;
  border: 1.5px solid var(--sand-border); border-radius: 10px;
  font-size: 0.95rem; outline: none; background: var(--white);
  transition: border-color 0.15s;
  margin-bottom: 8px; display: block;
}
#dir-search:focus { border-color: var(--gold); }

/* Filter row: 2×2 grid (all 4 dropdowns fit on mobile) */
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.filter-row select {
  padding: 7px 8px; border: 1.5px solid var(--sand-border); border-radius: 8px;
  font-size: 0.8rem; background: var(--white); outline: none;
  cursor: pointer; color: var(--text-primary); width: 100%;
}
.filter-row select:focus { border-color: var(--gold); }
.filter-active { border-color: var(--gold) !important; background: #fdf6e8 !important; color: var(--crimson) !important; }

/* Always-visible toolbar: count + view-toggle */
.dir-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0 10px;
  border-top: 1px solid var(--sand-border);
}
#dir-count { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

/* View toggle button */
.view-toggle-btn {
  background: var(--sand); border: 1px solid var(--sand-border);
  color: var(--text-primary); font-size: 0.78rem; font-weight: 600;
  padding: 5px 11px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s;
}
.view-toggle-btn:hover { background: var(--sand-border); }
.view-toggle-btn.active { background: var(--crimson); color: var(--warm-bg); border-color: var(--crimson); }

/* ── Compact list view ───────────────────────────────────────── */
#dir-grid.compact-list { display: block; padding: 0; max-width: 100%; }
.compact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--sand-border);
  cursor: pointer; background: var(--white);
  transition: background 0.1s;
}
.compact-row:first-child { border-top: 1px solid var(--sand-border); }
.compact-row:hover { background: var(--sand); }
.compact-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #f0e4d0, var(--sand));
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700; color: var(--crimson); overflow: hidden;
}
.compact-avatar img { width: 100%; height: 100%; object-fit: cover; }
.compact-name {
  flex: 1; min-width: 0;
  font-size: 0.92rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.compact-meta {
  font-size: 0.75rem; color: var(--text-muted);
  white-space: nowrap; text-align: right; flex-shrink: 0;
}

#dir-loading {
  display: none; text-align: center; padding: 40px 20px;
  color: var(--text-muted); font-size: 0.92rem;
}
#dir-empty {
  display: none; text-align: center; padding: 60px 24px; color: var(--text-light);
}
#dir-empty .empty-icon { font-size: 2.4rem; margin-bottom: 12px; }

/* Card grid */
#dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  grid-auto-rows: 1fr;
  gap: 14px; padding: 16px;
  max-width: 1100px; margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE CARD
═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--white); border-radius: 14px;
  box-shadow: 0 2px 10px rgba(58,48,40,0.08);
  padding: 16px; display: flex; gap: 13px; align-items: flex-start;
  transition: box-shadow 0.15s, transform 0.15s;
  border: 1px solid var(--sand-border);
  height: 100%;
}
.card:hover { box-shadow: 0 6px 22px rgba(58,48,40,0.14); transform: translateY(-1px); }
.avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #f0e4d0, var(--sand));
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; font-weight: 700; color: var(--crimson); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-name { font-size: 0.98rem; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.card-badges { margin-top: 4px; }
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  padding: 2px 7px; border-radius: 20px; margin: 2px 3px 0 0;
  background: #f5ebe0; color: var(--crimson);
}
.badge.college   { background: #e8eaf6; color: #283593; font-weight: 700; }
.badge.branch    { background: #fdf0e0; color: #7a4900; }
.badge.city      { background: #e8f5e9; color: #1b5e20; }
.badge.hometown  { background: #f3e8ff; color: #5b21b6; }
.badge-linkedin  { background: #e8f0fb; color: #0A66C2; text-decoration: none; display: inline-flex; align-items: center; }
.badge-linkedin:hover { background: #0A66C2; color: #fff; }
.badge-linkedin:hover svg rect { fill: #fff !important; }
.badge-linkedin:hover svg path { fill: #0A66C2 !important; }
.badge-phone     { background: #e8f5e9; color: #2d7a2d; text-decoration: none; display: inline-flex; align-items: center; }
.badge-phone:hover { background: #2d7a2d; color: #fff; }
.badge-sms       { background: #e8f0fb; color: #1a56b0; text-decoration: none; display: inline-flex; align-items: center; }
.badge-sms:hover { background: #1a56b0; color: #fff; }
.badge-wa        { background: #e8f8ec; color: #128c3e; text-decoration: none; display: inline-flex; align-items: center; }
.badge-wa:hover  { background: #25D366; color: #fff; }
.card-company { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; font-weight: 500; }
.card-company .at { color: var(--text-light); font-weight: 400; }
.fun-fact {
  font-size: 0.78rem; color: var(--text-muted); font-style: italic;
  margin-top: 6px; line-height: 1.45;
  border-left: 3px solid var(--gold); padding-left: 8px;
}
.card-guest { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }

/* ═══════════════════════════════════════════════════════════════
   EDIT VIEW
═══════════════════════════════════════════════════════════════ */
.edit-container { max-width: 620px; margin: 0 auto; padding: 20px 16px 60px; }
.edit-section { margin-bottom: 22px; }
.edit-section h3 {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 12px;
  padding-bottom: 6px; border-bottom: 1px solid var(--sand-border);
}
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="url"],
.form-row select,
.form-row textarea {
  width: 100%; padding: 11px 13px;
  border: 1.5px solid var(--sand-border); border-radius: 10px;
  font-size: 0.95rem; outline: none; transition: border-color 0.15s;
  background: var(--white); color: var(--text-primary);
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--gold); }
.form-row.readonly input, .form-row.readonly .readonly-val {
  background: var(--sand); color: var(--text-muted); cursor: default;
}
.readonly-val {
  display: block; width: 100%; padding: 11px 13px;
  border: 1.5px solid var(--sand-border); border-radius: 10px;
  font-size: 0.95rem; color: var(--text-muted); background: var(--sand);
}
.toggle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
}
.toggle-row label { font-size: 0.88rem; font-weight: 500; color: var(--text-primary); margin: 0; flex: 1; }
.toggle-row input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; flex-shrink: 0; accent-color: var(--crimson); }
/* Name-edit warning box */
.name-edit-warning {
  background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px;
  padding: 10px 13px; font-size: 0.82rem; color: #7a5200;
  margin-top: 8px; line-height: 1.5;
}

/* Photo URL instructional hint */
.photo-hint {
  font-size: 0.78rem; color: var(--text-muted); margin: 4px 0 8px;
  line-height: 1.5; background: var(--sand); border-radius: 7px;
  padding: 7px 10px;
}

/* Guest login hint on login page — inherits color from .login-hint (var(--text-muted)) */
.guest-hint { margin-top: 6px; }

.edit-actions {
  display: flex; gap: 12px; padding: 16px;
  position: sticky; bottom: 0; background: var(--warm-bg);
  border-top: 1px solid var(--sand-border); margin-top: 20px;
}
.btn-primary {
  flex: 1; padding: 14px; background: var(--crimson); color: var(--warm-bg);
  border: none; border-radius: 10px; font-weight: 700; font-size: 1rem;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary {
  flex: 0 0 100px; padding: 14px; background: var(--sand); color: var(--text-primary);
  border: none; border-radius: 10px; font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   QR SHOW VIEW
═══════════════════════════════════════════════════════════════ */
#view-qr-show {
  background: var(--warm-bg); display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; padding: 30px 20px; text-align: center;
  cursor: pointer;
}
#qr-canvas-container { margin-bottom: 20px; }
#qr-canvas-container canvas,
#qr-canvas-container img { border-radius: 12px; box-shadow: 0 4px 20px rgba(58,48,40,0.15); }
#qr-your-name { font-size: 1.5rem; font-weight: 700; color: var(--crimson); margin-bottom: 6px; }
#qr-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.qr-dismiss-hint { font-size: 0.78rem; color: var(--text-light); margin-top: 16px; }

/* ═══════════════════════════════════════════════════════════════
   QR SCAN VIEW
═══════════════════════════════════════════════════════════════ */
#view-qr-scan { background: var(--dark-navy); color: var(--warm-bg); padding-bottom: 60px; }
.qr-scan-header { padding: 16px; display: flex; align-items: center; gap: 12px; }
.qr-scan-header h2 { font-size: 1.1rem; color: var(--warm-bg); }
.btn-back {
  background: rgba(247,243,236,0.15); border: none; color: var(--warm-bg);
  padding: 7px 13px; border-radius: 8px; font-size: 0.82rem; cursor: pointer;
}
#qr-scan-camera { position: relative; width: 100%; max-width: 500px; margin: 0 auto; }
#qr-video { width: 100%; border-radius: 12px; display: block; }
#qr-canvas { display: none; }
.scan-crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 200px; height: 200px; border: 3px solid var(--gold); border-radius: 12px;
  pointer-events: none;
}
.scan-status {
  padding: 12px 16px; font-size: 0.88rem; text-align: center;
  min-height: 42px; color: rgba(247,243,236,0.6);
}
.scan-status.error { color: #e74c3c; }
.scan-status.warn  { color: var(--gold); }
#qr-scan-upload { display: none; padding: 24px 20px; text-align: center; }
#qr-scan-upload p { color: rgba(247,243,236,0.6); margin-bottom: 16px; }
.btn-upload-label {
  display: inline-block; padding: 12px 24px;
  background: var(--gold); color: var(--dark-navy); border-radius: 10px;
  font-weight: 700; cursor: pointer;
}
#qr-file-input { display: none; }

/* ═══════════════════════════════════════════════════════════════
   HISTORY VIEW
═══════════════════════════════════════════════════════════════ */
.history-container { max-width: 600px; margin: 0 auto; padding: 16px; }
.history-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.history-toolbar h2 { font-size: 1.05rem; font-weight: 700; color: var(--crimson); }
.btn-clear { background: none; border: none; color: var(--error); font-size: 0.8rem; cursor: pointer; font-weight: 600; }
.history-item {
  display: flex; align-items: center; gap: 13px;
  background: var(--white); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(58,48,40,0.07); cursor: pointer;
  border: 1px solid var(--sand-border);
  transition: box-shadow 0.15s;
}
.history-item:hover { box-shadow: 0 3px 14px rgba(58,48,40,0.12); }
.hist-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #f0e4d0, var(--sand));
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 700; color: var(--crimson);
}
.hist-body { flex: 1; min-width: 0; }
.hist-name { font-size: 0.92rem; font-weight: 700; color: var(--text-primary); }
.hist-sub  { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.hist-time { font-size: 0.72rem; color: var(--text-light); white-space: nowrap; }
.empty-msg { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 0.9rem; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════
   PROFILE MODAL  (shown after QR scan / card tap)
═══════════════════════════════════════════════════════════════ */
#modal-profile {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(28,28,46,0.65);
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--warm-bg); border-radius: 18px;
  width: 100%; max-width: 440px;
  padding: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
  position: relative;
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--sand); border: none; border-radius: 50%;
  width: 30px; height: 30px; font-size: 1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.modal-close:hover { background: var(--sand-border); }
#modal-card-slot .card { box-shadow: none; padding: 0; border: none; }

/* ═══════════════════════════════════════════════════════════════
   ADMIN VIEW
═══════════════════════════════════════════════════════════════ */
.admin-container { max-width: 600px; margin: 0 auto; padding: 20px 16px 60px; }
.admin-pw-section { text-align: center; padding: 30px 0; }
.admin-pw-section p { color: var(--text-muted); margin-bottom: 18px; font-size: 0.9rem; }
.admin-pw-section input {
  padding: 11px 14px; border: 1.5px solid var(--sand-border); border-radius: 10px;
  font-size: 0.95rem; width: 100%; max-width: 280px; outline: none;
  display: block; margin: 0 auto 12px; background: var(--white);
}
.admin-pw-section input:focus { border-color: var(--gold); }
.admin-pw-section button {
  padding: 11px 28px; background: var(--crimson); color: var(--warm-bg);
  border: none; border-radius: 10px; font-weight: 700; cursor: pointer;
}
#admin-pw-error { color: var(--error); font-size: 0.82rem; margin-top: 8px; }
#admin-panel { display: none; }
.admin-section { margin-bottom: 28px; }
.admin-analytics-stat { background:#fff; border:1px solid var(--sand-border); border-radius:10px; padding:12px; text-align:center; }
.aas-val  { font-size:1.6rem; font-weight:700; color:var(--crimson); line-height:1; }
.aas-lbl  { font-size:11px; color:var(--text-muted); margin-top:4px; }
.admin-chart-wrap  { background:#fff; border:1px solid var(--sand-border); border-radius:10px; padding:14px; }
.admin-chart-title { font-size:12px; font-weight:600; color:var(--text-muted); margin-bottom:10px; }
.admin-section h3 {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 14px;
  padding-bottom: 6px; border-bottom: 1px solid var(--sand-border);
}
.admin-field { margin-bottom: 14px; }
.admin-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.admin-field input, .admin-field select {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--sand-border); border-radius: 9px;
  font-size: 0.92rem; outline: none; background: var(--white); color: var(--text-primary);
}
.admin-field input:focus { border-color: var(--gold); }
.admin-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }
.btn-danger { background: var(--error); color: #fff; padding: 11px 20px; border: none; border-radius: 9px; font-weight: 700; cursor: pointer; }
.btn-sync {
  width: 100%; padding: 13px; background: var(--gold); color: var(--dark-navy);
  border: none; border-radius: 10px; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.btn-sync:hover { background: var(--gold-dark); }
.btn-sync:disabled { opacity: 0.6; }
.admin-save {
  width: 100%; padding: 14px; background: var(--crimson); color: var(--warm-bg);
  border: none; border-radius: 10px; font-weight: 700; font-size: 1rem;
  cursor: pointer; margin-top: 8px;
}
.admin-save:hover { background: var(--crimson-dark); }

/* ═══════════════════════════════════════════════════════════════
   MOBILE  ≤ 480px
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .page-header h1 { font-size: 1.05rem; }
  #dir-grid { grid-template-columns: 1fr; padding: 10px; }
  .card { padding: 13px; }
  .greeting-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .action-btns { width: 100%; }
  .action-btn { flex: 1; justify-content: center; }
  .modal-box { padding: 18px; }
}

/* ═══════════════════════════════════════════════════════════════
   HOME PERSONALISATION  — completion banner + suggestion boxes
═══════════════════════════════════════════════════════════════ */

/* Profile completion banner */
.completion-banner {
  background: #fff3cd;
  border: 1.5px solid #ffc107;
  border-radius: 10px;
  padding: 11px 14px;
  margin: 10px 12px 0;
  font-size: 0.86rem;
  color: #6b4c00;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
}
.completion-banner-text { flex: 1; }
.completion-banner a {
  color: var(--crimson);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.completion-banner a:hover { text-decoration: underline; }
.banner-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  margin-top: 1px;
}

/* Suggestion boxes */
.suggestion-boxes-wrap {
  margin: 10px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suggestion-box {
  border: 1.5px solid var(--sand-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--white);
}
.suggestion-box-toggle {
  width: 100%;
  text-align: left;
  background: var(--sand);
  border: none;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.suggestion-box-toggle:hover { background: var(--sand-border); }
.suggestion-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.suggestion-box-toggle .controls-chevron {
  margin-left: auto;
  transition: transform 0.15s;
  font-size: 0.85rem;
}
.suggestion-box-toggle[aria-expanded="true"] .controls-chevron {
  transform: rotate(180deg);
}
.suggestion-box-body { border-top: 1px solid var(--sand-border); }
.suggestion-box-body.collapsed { display: none; }

/* ═══════════════════════════════════════════════════════════════
   DIRECTORY REDESIGN
═══════════════════════════════════════════════════════════════ */
.greeting-bar { padding: 12px 16px; }

.suggestion-boxes-wrap,
.all-attendees-box {
  max-width: 1100px;
  margin-left: 12px;
  margin-right: 12px;
}

.all-attendees-box {
  margin-top: 10px;
  margin-bottom: 72px;
  overflow: visible;
}

.all-attendees-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  background: var(--sand);
  border-bottom: 1px solid var(--sand-border);
}

.all-attendees-toggle {
  min-width: 0;
  background: transparent;
  padding: 11px 10px 11px 14px;
}

.all-attendees-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.all-attendees-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
}

.filters-toggle-btn,
.view-segmented button,
.filter-clear-btn {
  min-height: 36px;
  border: 1px solid var(--sand-border);
  background: var(--white);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}

.filters-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
}

.filters-toggle-btn[aria-expanded="true"] {
  border-color: var(--gold);
  background: #fff8e8;
  color: var(--crimson);
}

.view-segmented {
  display: inline-flex;
  border: 1px solid var(--sand-border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--white);
}

.view-segmented button {
  border: 0;
  border-radius: 0;
  min-width: 48px;
  padding: 0 9px;
  background: transparent;
}

.view-segmented button.active {
  background: var(--crimson);
  color: var(--warm-bg);
}

.all-attendees-body.collapsed,
.filters-sheet.collapsed {
  display: none;
}

.directory-search-wrap {
  position: sticky;
  top: 52px;
  z-index: 80;
  background: var(--warm-bg);
  border-bottom: 1px solid var(--sand-border);
  padding: 10px;
}

.directory-search-wrap #dir-search {
  margin: 0;
  min-height: 44px;
  font-size: 1rem;
}

.filters-sheet {
  margin-top: 8px;
  padding: 8px;
  background: #fffaf1;
  border: 1px solid var(--sand-border);
  border-radius: 10px;
}

.filter-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-row select {
  min-width: 104px;
  min-height: 38px;
  flex: 1 0 104px;
  font-size: 0.84rem;
}

.filter-clear-btn {
  width: 100%;
  margin-top: 8px;
  background: var(--sand);
}

#dir-grid {
  max-width: none;
  margin: 0;
  padding: 10px;
  grid-auto-rows: auto;
}

#dir-grid.compact-list {
  padding: 0;
}

.compact-row {
  min-height: 58px;
  padding: 10px 14px;
}

.compact-name { font-size: 0.98rem; }
.compact-meta { font-size: 0.8rem; }

.card {
  height: auto;
  min-height: 0;
  border-radius: 10px;
  padding: 12px;
  gap: 10px;
}

.avatar {
  width: 46px;
  height: 46px;
  font-size: 1.05rem;
}

.card-name { font-size: 1rem; }
.card-badges { margin-top: 3px; }
.badge { font-size: 0.68rem; padding: 2px 6px; }
.card-company { font-size: 0.78rem; margin-top: 4px; }

.fun-fact {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE COMPLETION PROMPT
═══════════════════════════════════════════════════════════════ */
.profile-nudge-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(28, 28, 46, 0.58);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-nudge-modal.show { display: flex; }

.profile-nudge-box {
  width: 100%;
  max-width: 420px;
  background: var(--warm-bg);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.32);
  border: 1px solid var(--sand-border);
  padding: 20px;
}

.profile-nudge-box h2 {
  font-size: 1.2rem;
  color: var(--crimson);
  margin-bottom: 8px;
}

.profile-nudge-box p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.profile-nudge-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.profile-nudge-actions button {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.profile-nudge-edit {
  background: var(--crimson);
  color: var(--warm-bg);
}

.profile-nudge-later {
  background: var(--sand);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════
   EDIT PAGE REDESIGN
═══════════════════════════════════════════════════════════════ */
.edit-top-actions,
.history-top-actions {
  position: sticky;
  top: 52px;
  z-index: 90;
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(247, 243, 236, 0.96);
  border-bottom: 1px solid var(--sand-border);
  backdrop-filter: blur(10px);
}

.edit-top-actions { justify-content: space-between; }
.history-top-actions { justify-content: flex-start; }

.edit-top-link,
.edit-top-save,
.history-directory-btn {
  min-height: 40px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.edit-top-link,
.history-directory-btn {
  border: 1px solid var(--sand-border);
  background: var(--white);
  color: var(--text-primary);
  padding: 0 14px;
}

.history-directory-btn {
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.92rem;
  font-weight: 800;
}

.edit-top-save {
  border: 0;
  background: var(--crimson);
  color: var(--warm-bg);
  padding: 0 18px;
}

.edit-top-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.edit-completion-card {
  max-width: 620px;
  margin: 14px auto 0;
  padding: 14px 16px;
  background: #fff8e8;
  border: 1px solid #f2cf77;
  border-left: 5px solid var(--gold);
  border-radius: 12px;
}

.edit-completion-title {
  font-weight: 800;
  color: var(--crimson);
  margin-bottom: 3px;
}

.edit-completion-card p {
  color: #705015;
  font-size: 0.86rem;
  line-height: 1.45;
}

.edit-completion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.completion-pill {
  border: 1px solid #e6c35f;
  background: var(--white);
  color: #705015;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.completion-pill.done {
  border-color: #9cc7a0;
  background: #edf8ee;
  color: #27632f;
}

.priority-field {
  border-left: 4px solid var(--gold);
  padding-left: 10px;
  background: linear-gradient(90deg, #fff9eb 0, rgba(255,255,255,0) 70%);
  border-radius: 8px;
}

.priority-field.complete {
  border-left-color: #5c9b61;
  background: linear-gradient(90deg, #eff8f0 0, rgba(255,255,255,0) 70%);
}

.field-chip {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff1c7;
  color: #7a5200;
  font-size: 0.68rem;
  font-weight: 800;
  vertical-align: middle;
}

.priority-field.complete .field-chip {
  background: #e4f3e5;
  color: #27632f;
}

/* ═══════════════════════════════════════════════════════════════
   QR AND MODAL USABILITY
═══════════════════════════════════════════════════════════════ */
.qr-scan-header { align-items: flex-start; }

.qr-home-btn {
  min-height: 44px;
  min-width: 86px;
  background: var(--gold);
  color: var(--dark-navy);
  font-weight: 800;
}

.qr-scan-subtitle {
  margin-top: 3px;
  color: rgba(247,243,236,0.72);
  font-size: 0.82rem;
  line-height: 1.35;
}

.qr-history-callout {
  max-width: 500px;
  margin: 0 auto 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(247,243,236,0.1);
  border: 1px solid rgba(247,243,236,0.18);
  border-radius: 12px;
}

.qr-history-callout div {
  flex: 1;
  min-width: 0;
}

.qr-history-callout strong,
.qr-history-callout span {
  display: block;
}

.qr-history-callout strong {
  font-size: 0.86rem;
  color: var(--warm-bg);
}

.qr-history-callout span {
  margin-top: 2px;
  font-size: 0.78rem;
  color: rgba(247,243,236,0.68);
}

.qr-history-callout button {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  padding: 0 12px;
  background: var(--warm-bg);
  color: var(--dark-navy);
  font-weight: 800;
  cursor: pointer;
}

.modal-dismiss-hint {
  margin-top: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (min-width: 700px) {
  .suggestion-boxes-wrap,
  .all-attendees-box {
    margin-left: auto;
    margin-right: auto;
  }

  #dir-grid:not(.compact-list) {
    grid-auto-rows: 1fr;
    padding: 14px;
  }

  #dir-grid:not(.compact-list) .card {
    height: 100%;
  }
}

@media (max-width: 420px) {
  .all-attendees-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .all-attendees-toggle {
    padding-right: 4px;
  }

  .all-attendees-actions {
    gap: 4px;
    padding-right: 6px;
  }

  .filters-toggle-btn {
    padding: 0 8px;
  }

  .view-segmented button {
    min-width: 43px;
    padding: 0 7px;
  }

  .qr-history-callout {
    margin-left: 12px;
    margin-right: 12px;
    align-items: stretch;
    flex-direction: column;
  }
}
