/* ──── FindJeeves App Styles ──── */
/* Phase 2: Full polish */

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

:root {
  --bg-deep: #050507;
  --bg-surface: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-input: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 179, 237, 0.4);
  --text-primary: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-muted: #555566;
  --accent: #63b3ed;
  --accent-dim: rgba(99, 179, 237, 0.15);
  --accent-border: rgba(99, 179, 237, 0.3);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.15);
  --purple-border: rgba(167, 139, 250, 0.3);
  --green: #26de81;
  --green-dim: rgba(38, 222, 129, 0.15);
  --red: #ff6b6b;
  --red-dim: rgba(255, 107, 107, 0.15);
  --yellow: #ffd43b;
  --yellow-dim: rgba(255, 212, 59, 0.15);
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 179, 237, 0.03) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(167, 139, 250, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

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

/* ── Nav ── */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 12px 0;
  background: rgba(5, 5, 7, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.app-nav .nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-nav .logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  text-decoration: none;
}
.app-nav .logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s;
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-decoration: none;
}
.nav-avatar:hover { text-decoration: none; }
.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Notification bell */
.nav-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}
.nav-bell:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  text-decoration: none;
}
.nav-bell svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Mobile hamburger ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all 0.2s;
}
.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.nav-mobile-menu {
  display: none;
  position: fixed;
  top: 57px;
  left: 0; right: 0;
  background: rgba(5, 5, 7, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  z-index: 99;
  flex-direction: column;
  gap: 4px;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
}
.nav-mobile-menu a:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-mobile-menu a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.page {
  padding-top: 80px;
  min-height: 100vh;
}

.page-header {
  padding: 32px 0 24px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.page-header p {
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s;
}
.card:hover {
  background: var(--bg-card-hover);
}
.card-flat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--border-focus);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}
.form-group textarea {
  resize: vertical;
  min-height: 100px;
}
.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%238a8a9a'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-group select option {
  background: #1a1a2e;
  color: var(--text-primary);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 6px;
}
.form-help {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  position: relative;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #050507;
}
.btn-primary:hover { background: #7cc4f5; transform: translateY(-1px); }

.btn-purple {
  background: var(--purple);
  color: #050507;
}
.btn-purple:hover { background: #b89efc; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-green {
  background: var(--green);
  color: #050507;
}
.btn-green:hover { background: #3ce693; }

.btn-red {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, 0.3);
}
.btn-red:hover { background: rgba(255, 107, 107, 0.25); }

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}
.btn-xs {
  padding: 5px 12px;
  font-size: 12px;
}

/* Button loading state */
.btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

/* ── Badges / Tags ── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-blue { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid var(--purple-border); }
.badge-green { background: var(--green-dim); color: var(--green); border: 1px solid rgba(38, 222, 129, 0.3); }
.badge-red { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255, 107, 107, 0.3); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255, 212, 59, 0.3); }
.badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border); }

.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.tag:hover, .tag.selected {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ── Stars ── */
.stars {
  display: inline-flex;
  gap: 2px;
  font-size: 16px;
}
.stars .star { color: var(--text-muted); cursor: pointer; }
.stars .star.filled { color: var(--yellow); }
.stars .star:hover { color: var(--yellow); }

.star-display {
  display: inline-flex;
  gap: 1px;
  color: var(--yellow);
  font-size: 14px;
}

/* ── Status badges ── */
.status-open { background: var(--green-dim); color: var(--green); border: 1px solid rgba(38, 222, 129, 0.3); }
.status-in-progress { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.status-completed { background: var(--purple-dim); color: var(--purple); border: 1px solid var(--purple-border); }
.status-cancelled { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255, 107, 107, 0.3); }
.status-pending { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255, 212, 59, 0.3); }
.status-accepted { background: var(--green-dim); color: var(--green); border: 1px solid rgba(38, 222, 129, 0.3); }
.status-rejected { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255, 107, 107, 0.3); }

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── Job Cards ── */
.job-list { display: flex; flex-direction: column; gap: 12px; }

.job-card {
  display: block;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-primary);
}
.job-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-border);
  text-decoration: none;
  transform: translateY(-1px);
}

.job-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.job-card-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.job-card-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.job-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Distance badge */
.distance-badge {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

/* ── Avatar ── */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-sm { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 80px; height: 80px; font-size: 28px; }

/* Default avatar SVG when no photo */
.avatar-default {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.avatar-default svg {
  width: 50%;
  height: 50%;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
}

/* ── Messages ── */
.msg-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  max-height: 60vh;
  overflow-y: auto;
}
.msg {
  display: flex;
  gap: 12px;
  max-width: 80%;
}
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.msg.mine .msg-bubble {
  background: var(--accent-dim);
  border-color: var(--accent-border);
}
.msg-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  animation: toastIn 0.3s ease;
  min-width: 250px;
  max-width: 400px;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.toast.removing {
  animation: toastOut 0.3s ease forwards;
}
.toast-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(38, 222, 129, 0.3); }
.toast-error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255, 107, 107, 0.3); }
.toast-info { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ── Loading ── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 5, 7, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
  white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Skills multi-select ── */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Auth pages ── */
.auth-container {
  max-width: 420px;
  margin: 0 auto;
  padding-top: 120px;
}
.auth-container h1 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}
.auth-container .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}
.auth-container .alt-link {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}
.auth-container .alt-link a { color: var(--accent); }

/* ── User type toggle ── */
.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.type-option {
  padding: 14px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.type-option:hover { border-color: var(--accent-border); color: var(--text-primary); }
.type-option.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}
.type-option .type-label { font-weight: 600; }
.type-option .type-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.type-option.selected .type-desc { color: var(--accent); opacity: 0.7; }

/* ── Dashboard ── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Activity feed ── */
.activity-feed {
  margin-top: 24px;
}
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}
.activity-dot.job_posted { background: var(--accent); }
.activity-dot.application_received { background: var(--yellow); }
.activity-dot.applied { background: var(--purple); }
.activity-dot.review_received { background: var(--green); }
.activity-info { flex: 1; }
.activity-info a {
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
}
.activity-info a:hover { color: var(--accent); text-decoration: none; }
.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Notification page ── */
.notif-list { margin-top: 16px; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  align-items: flex-start;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
}
.notif-item:hover {
  background: var(--bg-card-hover);
  text-decoration: none;
}
.notif-item.unread {
  border-color: var(--accent-border);
  background: rgba(99, 179, 237, 0.04);
}
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.notif-icon.new_application { background: var(--yellow-dim); color: var(--yellow); }
.notif-icon.application_accepted { background: var(--green-dim); color: var(--green); }
.notif-icon.application_rejected { background: var(--red-dim); color: var(--red); }
.notif-icon.new_message { background: var(--accent-dim); color: var(--accent); }
.notif-icon.review_received { background: var(--purple-dim); color: var(--purple); }
.notif-icon.job_completed { background: var(--green-dim); color: var(--green); }
.notif-icon.job_cancelled { background: var(--red-dim); color: var(--red); }
.notif-content { flex: 1; }
.notif-title { font-size: 14px; font-weight: 600; }
.notif-message { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.notif-time { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 24px 0;
  flex-wrap: wrap;
}
.pagination .page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.pagination .page-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}
.pagination .page-btn.active {
  background: var(--accent);
  color: #050507;
  border-color: var(--accent);
}
.pagination .page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Filter bar enhanced ── */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar input,
.filter-bar select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
}
.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--border-focus);
}
.filter-bar input::placeholder { color: var(--text-muted); }
.filter-bar select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%238a8a9a'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.filter-bar select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

/* ── Application cards ── */
.app-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  align-items: flex-start;
}
.app-card-info { flex: 1; }
.app-card-info h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.app-card-info p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.app-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Profile page ── */
.profile-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
}
.profile-header .profile-info { flex: 1; }
.profile-header h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.profile-header .profile-meta {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Photo upload ── */
.photo-upload {
  position: relative;
  cursor: pointer;
}
.photo-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.photo-upload .upload-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 12px;
  color: white;
}
.photo-upload:hover .upload-overlay { opacity: 1; }

/* ── Review form ── */
.review-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.review-stars .star {
  font-size: 28px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
}
.review-stars .star.active { color: var(--yellow); }
.review-stars .star:hover { color: var(--yellow); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .form-row { grid-template-columns: 1fr; }
  .type-toggle { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
  .card, .card-flat { padding: 18px; }
  .job-card { padding: 16px; }
  .dash-stats { grid-template-columns: 1fr 1fr; }

  /* Hide desktop nav links, show hamburger */
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }

  .msg { max-width: 90%; }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .app-card {
    flex-direction: column;
    align-items: stretch;
  }
  .app-card-actions {
    justify-content: flex-end;
  }
  
  .filter-bar {
    flex-direction: column;
  }
  .filter-bar input,
  .filter-bar select {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .dash-stats { grid-template-columns: 1fr; }
  .job-card-header { flex-direction: column; gap: 8px; }
}

/* ── Phase 3: Verification Badges ── */
.badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.badge-email-verified { background: var(--green-dim); color: var(--green); border: 1px solid rgba(38, 222, 129, 0.3); }
.badge-id-verified { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-bg-checked { background: var(--purple-dim); color: var(--purple); border: 1px solid var(--purple-border); }

.trust-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.trust-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  max-width: 120px;
}
.trust-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.trust-label {
  font-size: 12px;
  font-weight: 600;
}

/* ── Phase 3: Save/Favourite Buttons ── */
.btn-save, .btn-fav {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-save:hover, .btn-fav:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}
.btn-save.saved, .btn-fav.favourited {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ── Phase 3: Payment Status ── */
.payment-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.payment-none { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border); }
.payment-held { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255, 212, 59, 0.3); }
.payment-released { background: var(--green-dim); color: var(--green); border: 1px solid rgba(38, 222, 129, 0.3); }
.payment-paid { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }

/* ── Phase 3: Admin Tables ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.admin-table tr:hover td {
  background: var(--bg-card);
}

/* ── Phase 3: Cookie Consent ── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 16px 24px;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}
.cookie-banner a { color: var(--accent); }
.cookie-banner .btn { flex-shrink: 0; }

/* ── Phase 3: Map ── */
.map-container {
  width: 100%;
  height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.map-container .leaflet-container {
  height: 100%;
  width: 100%;
  background: #1a1a2e;
}

/* ── Phase 3: Template Cards ── */
.template-card {
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.2s;
}
.template-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-border);
}

/* ── Phase 3: Earnings ── */
.earnings-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.earnings-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 4px;
}
.earnings-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Phase 3: Alert Badges ── */
.alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.alert-item .alert-info {
  font-size: 14px;
}
.alert-item .alert-keyword {
  color: var(--accent);
  font-weight: 600;
}

/* ── Phase 4: Conversations ── */
.conversation-list {
  display: flex;
  flex-direction: column;
}

.conversation-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.2s;
}
.conversation-item:hover {
  background: var(--bg-card);
  text-decoration: none;
}
.conversation-item.unread {
  background: rgba(99, 179, 237, 0.03);
}
.conversation-item.unread .conv-name {
  color: var(--accent);
}

.conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}
.conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conv-info {
  flex: 1;
  min-width: 0;
}
.conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.conv-name {
  font-size: 15px;
  font-weight: 600;
}
.conv-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.conv-job-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.conv-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-sender {
  font-weight: 600;
  color: var(--text-muted);
}

.conv-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--accent);
  color: #050507;
  font-size: 11px;
  font-weight: 700;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Message read receipts */
.msg-read {
  font-size: 12px;
  color: var(--accent);
  margin-left: 4px;
}

/* Messages badge in nav */
.nav-msg-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--green);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Phase 4: Availability Calendar ── */
.avail-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
}
.avail-table th {
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}
.avail-table td {
  text-align: center;
  padding: 4px;
}
.avail-table .slot-label {
  text-align: left;
  padding: 8px 12px;
}

.avail-cell {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}
.avail-cell:hover {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}
.avail-cell.active {
  background: var(--green-dim);
  border-color: rgba(38, 222, 129, 0.4);
  color: var(--green);
  font-weight: 700;
}

@media (max-width: 768px) {
  .avail-cell {
    width: 36px;
    height: 36px;
    font-size: 12px;
    border-radius: 8px;
  }
  .avail-table .slot-label {
    padding: 4px 6px;
  }
  .avail-table .slot-label div:first-child {
    font-size: 13px;
  }
  .avail-table .slot-label div:last-child {
    display: none;
  }
}

/* ── Phase 4: Analytics Charts ── */
.chart-container {
  position: relative;
  height: 250px;
}

/* ── Phase 4: Rebook Button ── */
.btn-rebook {
  background: var(--purple-dim);
  color: var(--purple);
  border: 1px solid var(--purple-border);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-rebook:hover {
  background: rgba(167, 139, 250, 0.25);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════════════
   Phase 5: Quality, Accessibility & UX Refinement
   ══════════════════════════════════════════════════════════════════════ */

/* ── Focus indicators (a11y) ── */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Remove outline for mouse clicks, keep for keyboard */
*:focus:not(:focus-visible) {
  outline: none;
}

/* ── Skip to content link (a11y) ── */
.skip-link {
  position: fixed;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--accent);
  color: #050507;
  padding: 12px 24px;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ── Skeleton loaders ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.06) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}
.skeleton-text:last-child {
  width: 60%;
}
.skeleton-title {
  height: 22px;
  width: 70%;
  margin-bottom: 12px;
}
.skeleton-card {
  height: 120px;
  margin-bottom: 12px;
}
.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.skeleton-badge {
  height: 24px;
  width: 80px;
  display: inline-block;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Loading states ── */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
}
.page-loading .spinner {
  margin: 0;
}
.page-loading p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Empty states (enhanced) ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Network error state ── */
.error-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--red-dim);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: var(--radius-lg);
  margin: 20px 0;
}
.error-state h3 {
  color: var(--red);
  font-size: 16px;
  margin-bottom: 8px;
}
.error-state p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Form validation (enhanced) ── */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
  border-color: var(--red);
}
.form-group.has-error label {
  color: var(--red);
}
.form-group .char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-group .char-count.warn {
  color: var(--yellow);
}
.form-group .char-count.over {
  color: var(--red);
}

/* ── Required field indicator ── */
.form-group label .required {
  color: var(--red);
  margin-left: 2px;
}

/* ── Screen reader only ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── ARIA live region for toasts ── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* ── Improved mobile styles ── */
@media (max-width: 375px) {
  .container { padding: 0 12px; }
  .card, .card-flat { padding: 14px; }
  .page-header h1 { font-size: 22px; }
  .auth-container { padding-top: 90px; }
  .btn { padding: 10px 18px; font-size: 14px; }
  .stat-card .stat-value { font-size: 22px; }
  .earnings-value { font-size: 26px; }
  .type-toggle { gap: 6px; }
  .type-option { padding: 10px 8px; }
  .nav-inner { padding: 0 12px; }
}

@media (max-width: 320px) {
  .container { padding: 0 8px; }
  .page-header h1 { font-size: 20px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .nav-user .btn-logout { display: none; }
  .form-row { gap: 8px; }
}

/* ── Improved touch targets ── */
@media (pointer: coarse) {
  .btn, .tag, .tab, .avail-cell {
    min-height: 44px;
    min-width: 44px;
  }
  .nav-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .nav-hamburger {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ── Print styles ── */
@media print {
  .app-nav, .nav-mobile-menu, .cookie-banner, .toast-container {
    display: none !important;
  }
  body::before { display: none; }
  body { background: white; color: #222; }
  .page { padding-top: 0; }
  .card, .card-flat { border-color: #ddd; }
  a { color: #222; text-decoration: underline; }
}

/* ── Reduced motion (a11y) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton {
    animation: none;
    background: var(--bg-card);
  }
}

/* ── High contrast mode ── */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(255, 255, 255, 0.2);
    --text-secondary: #b0b0c0;
    --text-muted: #808090;
  }
  .badge, .tag {
    border-width: 2px;
  }
}

/* ── Phase 7: Portfolio Grid ── */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.portfolio-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s;
}
.portfolio-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.portfolio-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.portfolio-caption {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.portfolio-cat {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}
@media (max-width: 480px) {
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .portfolio-item img { height: 140px; }
}
