/* ═══════════════════════════════════════════════════════════
   CLEAR Talent Partner Portal — Shared Stylesheet
   ═══════════════════════════════════════════════════════════ */

:root {
  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --blue-light: #eff6ff;
  --green:      #16a34a;
  --green-light:#f0fdf4;
  --amber:      #d97706;
  --amber-light:#fffbeb;
  --purple:     #7c3aed;
  --purple-light:#f5f3ff;
  --red:        #dc2626;
  --red-light:  #fef2f2;
  --navy:       #0f172a;
  --navy-mid:   #1e293b;
  --navy-light: #334155;
  --slate:      #64748b;
  --slate-light:#94a3b8;
  --border:     #e2e8f0;
  --bg:         #f8fafc;
  --white:      #ffffff;
  --text:       #0f172a;
  --text-muted: #64748b;
  --sidebar-w:  240px;
  --header-h:   64px;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-decoration: none;
}
.sidebar-brand .logo {
  width: 34px; height: 34px;
  background: var(--blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand .brand-text { display: flex; flex-direction: column; }
.sidebar-brand .brand-name { font-size: 13px; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-brand .brand-sub  { font-size: 10px; color: var(--slate-light); letter-spacing: .04em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--slate-light);
  padding: 12px 18px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  text-decoration: none;
  color: #94a3b8;
  font-size: 13.5px; font-weight: 500;
  border-radius: 0;
  transition: color .15s, background .15s;
  cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover  { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(37,99,235,.25); border-right: 2px solid var(--blue); }
.nav-item svg    { width: 16px; height: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.partner-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.05);
  border-radius: 8px;
}
.partner-avatar {
  width: 34px; height: 34px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.partner-info { flex: 1; min-width: 0; }
.partner-name  { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.partner-role  { font-size: 10px; color: var(--slate-light); }
.logout-icon   { color: var(--slate-light); cursor: pointer; transition: color .15s; background: none; border: none; padding: 4px; border-radius: 4px; }
.logout-icon:hover { color: #fff; }

/* ── Main layout ──────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top header ───────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  background: var(--green-light);
  color: var(--green);
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.topbar-badge svg { width: 12px; height: 12px; }
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none; cursor: pointer; color: var(--slate);
  transition: all .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ── Page content ─────────────────────────────────────────── */
.page-content { padding: 28px; flex: 1; }
.page-header  { margin-bottom: 24px; }
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header p  { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 18px 22px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 700; }
.card-body  { padding: 20px 22px; }
.card-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

/* ── KPI Stat cards ───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.stat-card.blue::before   { background: var(--blue); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.amber::before  { background: var(--amber); }
.stat-card.green::before  { background: var(--green); }

.stat-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-card.blue   .stat-icon { background: var(--blue-light);   color: var(--blue); }
.stat-card.purple .stat-icon { background: var(--purple-light); color: var(--purple); }
.stat-card.amber  .stat-icon { background: var(--amber-light);  color: var(--amber); }
.stat-card.green  .stat-icon { background: var(--green-light);  color: var(--green); }
.stat-icon svg { width: 18px; height: 18px; }

.stat-value { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600;
  margin-top: 8px;
  padding: 2px 7px; border-radius: 10px;
}
.stat-trend.up   { background: var(--green-light); color: var(--green); }
.stat-trend.neutral { background: var(--bg); color: var(--slate); }

/* ── Charts grid ──────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 1000px) { .charts-grid { grid-template-columns: 1fr; } }

/* ── Referral link card ───────────────────────────────────── */
.ref-link-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.ref-link-text {
  flex: 1; font-size: 13px; font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--blue); color: #fff;
  border: none; border-radius: 6px;
  font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
.copy-btn:hover   { background: var(--blue-dark); }
.copy-btn.copied  { background: var(--green); }

.share-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.share-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.share-btn {
  width: 34px; height: 34px;
  border-radius: 8px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: var(--white);
  transition: all .15s; text-decoration: none; color: var(--slate);
}
.share-btn:hover { background: var(--bg); border-color: var(--slate-light); color: var(--text); }
.share-btn svg { width: 16px; height: 16px; }


/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 11px 16px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--slate);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 13px 16px; font-size: 13.5px; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; }
.badge-prospect  { background: var(--blue-light);   color: var(--blue); }
.badge-qualified { background: var(--amber-light);  color: var(--amber); }
.badge-converted { background: var(--green-light);  color: var(--green); }
.badge-lost      { background: #f1f5f9;              color: var(--slate); }
.badge-pending   { background: var(--amber-light);  color: var(--amber); }
.badge-approved  { background: var(--green-light);  color: var(--green); }
.badge-rejected  { background: #f1f5f9;              color: var(--slate); }
.badge-active    { background: var(--green-light);  color: var(--green); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s; text-decoration: none;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger    { background: var(--white); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--red-light); }
.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: none; }
.btn.loading .btn-text { display: none; }
.btn.loading .spinner  { display: block; }

/* ── Forms ────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-hint  { font-size: 12px; color: var(--text-muted); }
.form-input, .form-select, .form-textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px; color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
  appearance: none; -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.form-textarea { resize: vertical; min-height: 100px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13.5px; display: none; margin-bottom: 16px; }
.alert.show { display: flex; align-items: flex-start; gap: 10px; }
.alert-error   { background: var(--red-light);   border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: var(--green-light); border: 1px solid #bbf7d0; color: #166534; }
.alert-info    { background: var(--blue-light);  border: 1px solid #bfdbfe; color: #1e40af; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--slate-light);
}
.empty-state .empty-icon {
  width: 52px; height: 52px;
  background: var(--bg); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.empty-state .empty-icon svg { width: 26px; height: 26px; color: var(--slate-light); }
.empty-state h4 { font-size: 15px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ── Loading ──────────────────────────────────────────────── */
.page-loading { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: all .2s; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ── Section divider ──────────────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--slate);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Mobile overlay ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .page-content { padding: 16px; }
}

/* ── Link util ────────────────────────────────────────────── */
a.link { color: var(--blue); text-decoration: none; font-weight: 500; }
a.link:hover { text-decoration: underline; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 13px; }
.mono       { font-family: 'SF Mono', 'Fira Code', monospace; }
