/* ═══════════════════════════════════════════════════════
   HireZen CRM — Master Stylesheet
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────── */
:root {
  --brand:       #1e40af;
  --brand-light: #3b82f6;
  --accent:      #0ea5e9;
  --sidebar-bg:  #0f172a;
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1e293b;
  --muted:       #64748b;
  --danger:      #ef4444;
  --success:     #10b981;
  --warning:     #f59e0b;
  --info:        #06b6d4;
  --radius:      8px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.12);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--brand-light); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; }

/* ── Layout ──────────────────────────────────────────── */
.hz-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.hz-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid #1e293b;
}
.brand-icon {
  width: 34px; height: 34px; background: var(--brand-light);
  border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-weight: 800; color: #fff; font-size: 14px;
}
.brand-name { font-weight: 700; font-size: 1.05rem; color: #f1f5f9; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section {
  font-size: 0.68rem; font-weight: 700; color: #475569;
  letter-spacing: .08em; padding: 10px 16px 4px;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: #94a3b8;
  border-radius: 6px; margin: 1px 8px;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: #1e293b; color: #f1f5f9; text-decoration: none; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item svg { flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 0.7rem; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.sidebar-footer { border-top: 1px solid #1e293b; padding: 12px 0; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 16px 12px; }
.su-avatar {
  width: 32px; height: 32px; background: var(--brand);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.su-name { font-size: 0.82rem; color: #f1f5f9; font-weight: 600; }
.su-role { font-size: 0.72rem; color: #64748b; text-transform: capitalize; }
.nav-logout { color: #f87171 !important; }
.nav-logout:hover { background: #7f1d1d !important; color: #fca5a5 !important; }

/* Topbar */
.hz-topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border); z-index: 100;
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  box-shadow: var(--shadow);
}
.topbar-menu-btn {
  display: none; background: none; border: none; color: var(--text); padding: 4px;
}
.topbar-title { font-weight: 600; font-size: 1rem; flex: 1; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  display: flex; align-items: center; gap: 4px;
  background: #fef3c7; color: #92400e;
  border-radius: 20px; padding: 3px 10px; font-size: 0.78rem; font-weight: 600;
}
.topbar-user { font-size: 0.82rem; color: var(--muted); }

/* Main */
.hz-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 24px;
  flex: 1; min-height: calc(100vh - var(--topbar-h));
}

/* Overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 190;
}
.sidebar-overlay.show { display: block; }

/* ── Stat Cards ───────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 18px 16px; box-shadow: var(--shadow);
  border-left: 4px solid var(--brand);
}
.stat-card.accent-orange { border-color: #f97316; }
.stat-card.accent-green  { border-color: var(--success); }
.stat-card.accent-red    { border-color: var(--danger); }
.stat-card.accent-yellow { border-color: var(--warning); }
.stat-card.accent-teal   { border-color: var(--info); }
.stat-card.accent-purple { border-color: #8b5cf6; }
.stat-card.accent-pink   { border-color: #ec4899; }
.stat-val { font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: 6px; font-weight: 500; }

/* ── Card ────────────────────────────────────────────── */
.hz-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.hz-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.hz-card-title { font-weight: 700; font-size: 0.95rem; }
.hz-card-body { padding: 18px; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 0.72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap;
}
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-dark    { background: #334155; color: #e2e8f0; }
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-orange  { background: #ffedd5; color: #9a3412; }
.badge-teal    { background: #ccfbf1; color: #134e4a; }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-indigo  { background: #e0e7ff; color: #3730a3; }
.badge-purple  { background: #f3e8ff; color: #6b21a8; }
.badge-violet  { background: #ede9fe; color: #5b21b6; }
.badge-green   { background: #dcfce7; color: #14532d; }
.badge-lime    { background: #ecfccb; color: #3f6212; }
.badge-emerald { background: #a7f3d0; color: #064e3b; }
.badge-amber   { background: #fde68a; color: #78350f; }
.badge-success { background: #bbf7d0; color: #14532d; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-pink    { background: #fce7f3; color: #9d174d; }
.badge-admin   { background: #1e40af; color: #fff; }
.badge-associate { background: #7c3aed; color: #fff; }
.badge-qc      { background: #065f46; color: #fff; }
.badge-active  { background: #dcfce7; color: #14532d; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 600; border: none;
  transition: opacity .15s, box-shadow .15s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--brand);   color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-info     { background: var(--info);    color: #fff; }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-ghost    { background: transparent; color: var(--muted); }
.btn-sm       { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon     { padding: 6px; border-radius: 6px; }

/* ── Table ───────────────────────────────────────────── */
.hz-table-wrap { overflow-x: auto; }
.hz-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.hz-table th { background: #f8fafc; font-weight: 700; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 2px solid var(--border); text-align: left; white-space: nowrap; }
.hz-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.hz-table tr:last-child td { border-bottom: none; }
.hz-table tr:hover td { background: #f8fafc; }
.table-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Filter bar ──────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filter-bar input, .filter-bar select { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; background: var(--surface); color: var(--text); min-width: 140px; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 2px rgba(59,130,246,.2); }

/* ── Form ────────────────────────────────────────────── */
.hz-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hz-form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.hz-form-grid.cols-1 { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.col-span-2 { grid-column: span 2; }
.form-group.col-span-3 { grid-column: span 3; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.form-control {
  padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 0.9rem;
  background: var(--surface); color: var(--text);
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 2px rgba(59,130,246,.18); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Modals ──────────────────────────────────────────── */
.hz-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 300;
  align-items: center; justify-content: center; padding: 16px;
}
.hz-modal-box {
  background: var(--surface); border-radius: 12px;
  width: 100%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-md);
}
.hz-modal-box.modal-lg { max-width: 780px; }
.hz-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface);
}
.hz-modal-title { font-weight: 700; font-size: 1rem; }
.hz-modal-body { padding: 20px; }
.hz-modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Alerts ──────────────────────────────────────────── */
.hz-alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 0.88rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  transition: opacity .4s;
}
.hz-alert-success { background: #dcfce7; color: #14532d; border-left: 4px solid var(--success); }
.hz-alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.hz-alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.hz-alert-info    { background: #e0f2fe; color: #075985; border-left: 4px solid var(--info); }

/* ── QC Checklist ────────────────────────────────────── */
.qc-checklist { list-style: none; }
.qc-checklist li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.87rem; }
.qc-checklist li:last-child { border-bottom: none; }
.qc-checklist input[type="checkbox"] { width: 16px; height: 16px; margin-top: 3px; flex-shrink: 0; accent-color: var(--brand); }

/* ── CV Upload ───────────────────────────────────────── */
.cv-drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 28px 16px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.cv-drop-zone:hover, .cv-drop-zone.dragging { border-color: var(--brand-light); background: #eff6ff; }
.cv-drop-label { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* ── Timeline ────────────────────────────────────────── */
.hz-timeline { position: relative; padding-left: 20px; }
.hz-timeline::before { content:''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding: 0 0 16px 16px; }
.timeline-item::before {
  content:''; position: absolute; left: -16px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-light); border: 2px solid var(--surface);
}
.timeline-time { font-size: 0.72rem; color: var(--muted); }
.timeline-text { font-size: 0.85rem; }

/* ── Tabs ────────────────────────────────────────────── */
.hz-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  padding: 9px 18px; background: none; border: none;
  font-size: 0.88rem; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-btn:hover { color: var(--brand-light); }
.tab-panel { display: none; }
.tab-panel:first-of-type { display: block; }

/* ── Detail grid ─────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.detail-item .di-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.detail-item .di-value { font-size: 0.9rem; margin-top: 3px; }

/* ── Pill nav (pipeline stages) ─────────────────────── */
.stage-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stage-pill { padding: 5px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; cursor: pointer; border: 1.5px solid var(--border); background: var(--surface); }
.stage-pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Empty state ─────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* ── Duplicate warning ───────────────────────────────── */
.dup-warning { background: #fef3c7; border: 1px solid #fbbf24; border-radius: var(--radius); padding: 10px 14px; font-size: 0.84rem; margin-top: 6px; }
.dup-ok { color: var(--success); font-size: 0.82rem; }

/* ── Progress bar ────────────────────────────────────── */
.hz-progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.hz-progress-bar { height: 100%; background: var(--brand-light); border-radius: 3px; transition: width .4s; }

/* ── Quick action grid ───────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px; background: var(--surface); border-radius: var(--radius);
  border: 1.5px solid var(--border); text-align: center; cursor: pointer;
  transition: border-color .15s, box-shadow .15s; color: var(--text);
}
.quick-action-btn:hover { border-color: var(--brand-light); box-shadow: var(--shadow-md); text-decoration: none; color: var(--brand); }
.quick-action-btn svg { color: var(--brand-light); }

/* ── Funnel bars (reports) ───────────────────────────── */
.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.85rem; }
.funnel-label { width: 180px; flex-shrink: 0; color: var(--muted); font-size: 0.82rem; }
.funnel-bar-wrap { flex: 1; }
.funnel-bar { height: 22px; background: var(--brand-light); border-radius: 4px; min-width: 4px; display: flex; align-items: center; padding-left: 8px; color: #fff; font-size: 0.78rem; font-weight: 700; transition: width .5s; }
.funnel-count { width: 50px; text-align: right; font-weight: 700; color: var(--text); flex-shrink: 0; }

/* ── Bar chart (monthly) ─────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 100px; margin-top: 12px; }
.bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 4px; }
.bar-block { background: var(--brand-light); border-radius: 3px 3px 0 0; width: 100%; min-height: 2px; }
.bar-col-label { font-size: 0.65rem; color: var(--muted); }
.bar-col-val { font-size: 0.7rem; font-weight: 700; color: var(--text); }

/* ── QC Split panel ──────────────────────────────────── */
.qc-panel { display: grid; grid-template-columns: 1fr 1.6fr; gap: 0; min-height: 500px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.qc-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 70vh; }
.qc-list-item { padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.qc-list-item:hover, .qc-list-item.selected { background: #eff6ff; }
.qc-review { padding: 20px; overflow-y: auto; max-height: 70vh; }

/* ── Login page ──────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); padding: 16px; }
.login-card { background: #fff; border-radius: 14px; padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: 0 24px 48px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-brand { font-size: 2rem; font-weight: 900; color: var(--brand); }
.login-tagline { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.login-card h2 { font-size: 1.15rem; margin-bottom: 20px; text-align: center; color: var(--text); }

/* ── Skills match badges ─────────────────────────────── */
.skill-match   { background: #dcfce7; color: #14532d; }
.skill-missing { background: #fee2e2; color: #991b1b; }

/* ── Page header row ─────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 1.2rem; font-weight: 800; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .hz-sidebar { transform: translateX(-100%); }
  .hz-sidebar.open { transform: translateX(0); }
  .hz-topbar { left: 0; }
  .hz-main { margin-left: 0; }
  .topbar-menu-btn { display: flex; }
  .qc-panel { grid-template-columns: 1fr; }
  .qc-list { max-height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 640px) {
  .hz-form-grid { grid-template-columns: 1fr; }
  .hz-form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-group.col-span-2, .form-group.col-span-3 { grid-column: span 1; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .hz-main { padding: 14px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .funnel-label { width: 110px; }
  .quick-actions { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 18px; }
}
