/* ── BD Intelligence design system — "Direction A: Clean Modern SaaS" ──────
   Shared across every page. Change a token here and it changes everywhere.
   Palette: near-white surfaces, one confident indigo accent, left sidebar
   nav, generous whitespace, rounded cards — chosen over the old navy/blue
   corporate look to read as a modern SaaS product rather than an internal
   admin tool. */

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

:root {
  --bg:            #FAFAFA;
  --surface:       #FFFFFF;
  --surface-sunk:  #F4F4F6;
  --border:        #E7E7EA;
  --border-strong: #D6D6DC;
  --text:          #14141A;
  --muted:         #6B6B76;
  --faint:         #A3A3AD;

  --accent:        #5B4CF0;
  --accent-hover:  #4B3ADB;
  --accent-soft:   #EFEDFF;

  --success:       #12805C;
  --success-bg:    #E7F7F1;
  --warn:          #92620A;
  --warn-bg:       #FDF3E0;
  --danger:        #C13333;
  --danger-bg:     #FBEAEA;
  --info:          #2E5FD9;
  --info-bg:       #EBF0FE;

  --font:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:   'IBM Plex Mono', ui-monospace, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(20,20,26,0.04), 0 4px 16px rgba(20,20,26,0.04);
  --sidebar-w: 216px;
}

html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── App shell: sidebar + main content ─────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em; color: var(--text);
  padding: 6px 10px 18px; display: flex; align-items: center; gap: 9px;
}
.sidebar-brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); flex-shrink: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; text-decoration: none;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item:not(.active):hover { background: var(--surface-sunk); color: var(--text); }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 11.5px; color: var(--faint); padding: 6px 10px 8px; }
.sign-out-btn {
  width: 100%; background: transparent; border: 1px solid var(--border); color: var(--muted);
  font-family: var(--font); font-size: 12px; font-weight: 500; padding: 7px 10px; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left;
}
.sign-out-btn:hover { background: var(--surface-sunk); color: var(--text); }

.nav-toggle {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 200;
  width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); align-items: center; justify-content: center; cursor: pointer;
}
.nav-toggle svg { width: 18px; height: 18px; color: var(--text); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 190; transform: translateX(-100%);
    transition: transform 0.2s ease; box-shadow: 0 0 0 9999px rgba(0,0,0,0); width: 240px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,0.12); }
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 180; }
  .sidebar-backdrop.show { display: block; }
  .main { padding-top: 64px !important; }
}

.main { flex: 1; min-width: 0; padding: 28px 36px 70px; max-width: 1240px; }
@media (max-width: 640px) { .main { padding: 20px 16px 50px; } }

.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.pagehead .sub { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.6; max-width: 640px; }

/* ── Cards & sections ───────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-card); }
.card-title { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
@media (max-width: 760px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.kpi-label { font-size: 11px; color: var(--muted); display: flex; align-items: center; }
.kpi-val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
label { font-size: 11px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], select, textarea {
  padding: 9px 12px; border: 1px solid var(--border); background: var(--surface);
  font-family: var(--font); font-size: 13px; color: var(--text); border-radius: var(--radius-sm); width: 100%;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.hint { font-size: 11.5px; color: var(--faint); line-height: 1.5; margin-top: 6px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { padding: 9px 16px; font-family: var(--font); font-size: 12.5px; font-weight: 600; cursor: pointer; border: none; border-radius: var(--radius-sm); white-space: nowrap; transition: background .15s, opacity .15s; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunk); border-color: var(--border-strong); }
.btn-sm { padding: 6px 12px; font-size: 11.5px; }

/* ── Banners ────────────────────────────────────────────────────────────── */
.banner { padding: 12px 15px; font-size: 13px; margin: 12px 0; display: none; line-height: 1.6; border-radius: var(--radius-sm); }
.banner.show { display: block; }
.banner-success { background: var(--success-bg); border: 1px solid rgba(18,128,92,0.2); color: var(--success); }
.banner-error   { background: var(--danger-bg);  border: 1px solid rgba(193,51,51,0.2);  color: var(--danger); }
.banner-warn    { background: var(--warn-bg);    border: 1px solid rgba(146,98,10,0.2);  color: var(--warn); }
.banner-info    { background: var(--info-bg);    border: 1px solid rgba(46,95,217,0.2);  color: var(--info); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 9px 10px; border-bottom: 1px solid var(--surface-sunk); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-sunk); }

/* ── Pills / badges ─────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 100px; font-size: 10.5px; font-weight: 600; }
.pill-low, .pill-success  { background: var(--success-bg); color: var(--success); }
.pill-mid, .pill-warn     { background: var(--warn-bg); color: var(--warn); }
.pill-high, .pill-danger  { background: var(--danger-bg); color: var(--danger); }
.pill-neutral             { background: var(--surface-sunk); color: var(--muted); }
.chip { cursor: pointer; font-size: 11px; font-weight: 600; padding: 6px 14px; border-radius: 100px; background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ── Score circle (candidate match score, etc.) ────────────────────────── */
.score-circle { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: #fff; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ── Tooltip (hover "?" — plain-language help for jargon) ─────────────── */
.qmark {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
  border-radius: 50%; font-size: 10px; font-weight: 700; cursor: help; position: relative;
  margin-left: 5px; vertical-align: middle; background: var(--surface-sunk); color: var(--muted);
}
.qmark .tip {
  display: none; position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  width: 230px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 400;
  line-height: 1.5; text-align: left; z-index: 400; background: #1A1A22; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.qmark .tip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1A1A22; }
.qmark:hover .tip, .qmark:focus .tip { display: block; }
@media (max-width: 500px) { .qmark .tip { width: 180px; left: 0; transform: none; } .qmark .tip::after { left: 14px; transform: none; } }

/* ── Empty states / misc ────────────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--faint); font-size: 13px; }
.note { font-size: 11.5px; color: var(--faint); line-height: 1.6; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
