:root {
  --primary: #2d6a4f;
  --primary-dark: #1a472a;
  --primary-light: #52b788;
  --accent: #f4a261;
  --accent-dark: #e76f51;
  --bg: #f8faf9;
  --surface: #ffffff;
  --surface2: #eef4f1;
  --text: #1b2d25;
  --text-muted: #6b8a7a;
  --border: #c8ddd4;
  --danger: #d62828;
  --warning: #f4a261;
  --success: #40916c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

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

html { font-size: 16px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Layout ───────────────────────────────── */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.page { display: none; flex-direction: column; flex: 1; animation: fadeIn 0.25s ease; }
.page.active { display: flex; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Top-Bar ──────────────────────────────── */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topbar-title { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.01em; }
.topbar-subtitle { font-size: 0.7rem; opacity: 0.75; }
.topbar-logo { display: flex; flex-direction: column; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Bottom Nav ───────────────────────────── */
.bottom-nav {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  position: sticky;
  bottom: 0;
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  gap: 3px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  border: none;
  background: none;
  transition: color var(--transition);
  position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}
.nav-item svg { width: 22px; height: 22px; }

/* ── Content area ─────────────────────────── */
.content { flex: 1; padding: 16px; max-width: 680px; margin: 0 auto; width: 100%; }

/* ── Cards ────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-icon svg { width: 22px; height: 22px; color: var(--primary); }
.card-title { font-size: 1rem; font-weight: 700; }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b01e1e; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: 50%; background: transparent; border: none; cursor: pointer; color: #fff; }
.btn-icon:hover { background: rgba(255,255,255,0.15); }
.btn-icon svg { width: 20px; height: 20px; }

/* ── Forms ────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
  appearance: none;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,106,79,0.12); }
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; display: none; }
.form-error.visible { display: block; }

.checkbox-group { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.checkbox-group label { font-size: 0.85rem; color: var(--text); line-height: 1.4; }

/* ── Badges ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-green { background: #d8f3dc; color: #1b4332; }
.badge-orange { background: #ffe8d6; color: #7c3d12; }
.badge-blue { background: #dbeafe; color: #1e3a5f; }
.badge-red { background: #fee2e2; color: #7f1d1d; }
.badge-gray { background: var(--surface2); color: var(--text-muted); }

/* ── Alert banner ─────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: #dbeafe; color: #1e3a5f; }
.alert-warning { background: #fff3cd; color: #7c4d00; }
.alert-success { background: #d8f3dc; color: #1b4332; }
.alert-danger { background: #fee2e2; color: #7f1d1d; }

/* ── Install banner ───────────────────────── */
#install-banner {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 12px 16px;
  display: none;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease;
}
#install-banner.visible { display: flex; }
@keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: none; opacity: 1; } }
#install-banner p { flex: 1; font-size: 0.85rem; line-height: 1.4; }
#install-banner strong { display: block; font-size: 0.95rem; }

/* ── Demo banner ──────────────────────────── */
#demo-banner {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  display: none;
}
#demo-banner.visible { display: block; }

/* ── Hero / Landing ───────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff;
  padding: 40px 20px 36px;
  text-align: center;
}
.hero h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 6px; }
.hero p { font-size: 0.95rem; opacity: 0.85; max-width: 380px; margin: 0 auto 24px; line-height: 1.5; }
.hero-btn-group { display: flex; flex-direction: column; gap: 10px; max-width: 300px; margin: 0 auto; }

/* ── Role selector ────────────────────────── */
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.role-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
}
.role-card:hover, .role-card.selected { border-color: var(--primary); background: #eef6f1; }
.role-card svg { width: 36px; height: 36px; color: var(--primary); margin-bottom: 8px; }
.role-card h3 { font-size: 0.9rem; font-weight: 700; }
.role-card p { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; line-height: 1.3; }

/* ── Job list ─────────────────────────────── */
.job-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.job-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.job-title { font-weight: 700; font-size: 0.95rem; }
.job-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.job-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.job-pay { font-size: 0.85rem; font-weight: 700; color: var(--primary); }

/* ── Category chips ───────────────────────── */
.chip-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.chip:hover, .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Tabs ─────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Avatar / Profile ─────────────────────── */
.avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.6rem; }

/* ── Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.top-align { align-items: center; }
.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 680px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.25s ease;
}
.modal-overlay.top-align .modal { border-radius: var(--radius); }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); padding: 4px; }

/* ── Stats row ────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 10px; text-align: center; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ── Table ────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 10px 12px; background: var(--surface2); font-weight: 700; border-bottom: 2px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Section headings ─────────────────────── */
.section-title { font-size: 1rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 18px; height: 18px; color: var(--primary); }

/* ── Divider ──────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.divider-text { text-align: center; font-size: 0.78rem; color: var(--text-muted); position: relative; margin: 18px 0; }
.divider-text::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--border); z-index: 0; }
.divider-text span { background: var(--bg); padding: 0 10px; position: relative; z-index: 1; }

/* ── Spinner ──────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: #1b2d25;
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
  max-width: 340px;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Responsive ───────────────────────────── */
@media (min-width: 560px) {
  .hero-btn-group { flex-direction: row; max-width: 420px; }
  .content { padding: 20px 24px; }
  .modal { border-radius: var(--radius); }
}
@media (min-width: 768px) {
  .bottom-nav { max-width: 680px; margin: 0 auto; }
  .topbar { padding: 0 24px; }
}
