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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-md); }

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

button { font-family: inherit; cursor: pointer; }

/* Bare inline SVG icons (from ICONS.*) have no width/height attributes
   of their own — without an explicit size here, some mobile browsers
   render them at zero size instead of falling back to their viewBox
   dimensions, making icon-only buttons (like the mobile menu toggle)
   silently disappear. Every icon gets a guaranteed size. */
svg { width: 16px; height: 16px; flex-shrink: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(232,92,92,0.3); }
.btn-danger:hover { background: rgba(232,92,92,0.2); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: rgba(52,195,143,0.3); }
.btn-success:hover { background: rgba(52,195,143,0.2); }
.btn-sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn-icon { padding: 8px; }

/* ---- Inputs ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text-primary); border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: inherit; font-size: var(--fs-base);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }
.textarea { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- Cards / surfaces ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

/* ---- Trusted partner logo preview ---- */
.partner-logo-preview-box {
  display: flex; align-items: center; justify-content: center;
  height: 72px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-2);
}
.partner-logo-preview { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---- Image upload field (Supabase Storage-backed) ---- */
.image-upload { display: flex; align-items: center; gap: var(--sp-4); }
.image-upload__preview {
  flex-shrink: 0; width: 64px; height: 64px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
}
.image-upload__preview--circle { border-radius: 50%; }
.image-upload__preview--square { border-radius: var(--radius-sm); }
.image-upload__preview img { width: 100%; height: 100%; object-fit: cover; }
.image-upload__placeholder { color: var(--text-tertiary); display: inline-flex; }
.image-upload__placeholder svg { width: 22px; height: 22px; }
.image-upload__controls { flex: 1; min-width: 0; }
.image-upload__buttons { display: flex; gap: var(--sp-2); }
.image-upload__hint { font-size: var(--fs-2xs); color: var(--text-tertiary); min-height: 1.2em; margin-top: 6px; }
.image-upload__hint.is-error { color: var(--danger); }

/* ---- Badges (pipeline stage colors are the signature) ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--radius-full); font-size: var(--fs-2xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-applied { background: rgba(107,118,136,0.15); color: var(--stage-applied); }
.badge-identity_verification { background: rgba(232,169,77,0.15); color: var(--stage-verification); }
.badge-verification_complete { background: rgba(91,127,240,0.15); color: var(--stage-verified); }
.badge-interview_required, .badge-interview_scheduled, .badge-interview_completed { background: rgba(79,168,232,0.15); color: var(--stage-interview); }
.badge-offer_sent, .badge-offer_accepted, .badge-background_check { background: rgba(168,118,232,0.15); color: var(--stage-offer); }
.badge-hired { background: rgba(52,195,143,0.15); color: var(--stage-hired); }
.badge-rejected { background: rgba(232,92,92,0.15); color: var(--stage-rejected); }

/* ---- Table ---- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-tertiary); font-weight: 600; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
}
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); vertical-align: middle; }
.table tr:hover td { background: var(--surface-hover); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* ---- Toasts ---- */
.toast-stack { position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: 999; display: flex; flex-direction: column; gap: var(--sp-2); }
.toast {
  background: var(--surface-raised); border: 1px solid var(--border-strong); color: var(--text-primary);
  padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-card); font-size: var(--fs-sm);
  animation: toast-in 0.2s ease;
}
.toast.success { border-color: rgba(52,195,143,0.4); }
.toast.error { border-color: rgba(232,92,92,0.4); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: var(--sp-10) var(--sp-5); color: var(--text-secondary); }
.empty-state h3 { color: var(--text-primary); margin-bottom: var(--sp-2); }
.empty-state svg { width: 36px; height: 36px; margin-bottom: var(--sp-3); color: var(--text-tertiary); }

/* ---- Skeleton ---- */
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-raised) 37%, var(--surface) 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; border-radius: var(--radius-md); }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   PWA safe-area support — keeps content clear of notches,
   camera cutouts, and the home-indicator bar in standalone
   (installed) mode. No-ops with padding 0 on devices/browsers
   that don't report safe-area insets, so normal browser tabs
   are unaffected. Additive only; nothing above this changes.
   ========================================================= */
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.sidebar {
  padding-top: env(safe-area-inset-top, 0px);
}
.toast-stack {
  bottom: max(var(--sp-6, 24px), calc(var(--sp-6, 24px) + env(safe-area-inset-bottom, 0px)));
}
