/* Finary-inspired design tokens */
:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1a1e25;
  --surface-3: #21262f;
  --border: #232830;
  --border-soft: #1c2027;
  --text: #f5f5f7;
  --text-dim: #a1a7b3;
  --text-mute: #6b7280;
  --yellow: #ffd60a;
  --yellow-soft: rgba(255, 214, 10, 0.15);
  --blue: #4d8df6;
  --blue-soft: #7ea8f7;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.15);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.14);
  --orange: #fb923c;
  --purple: #a78bfa;
  --pink: #f472b6;
  --teal: #2dd4bf;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container { max-width: 1440px; margin: 0 auto; padding: 0 28px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 13, 16, 0.85);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 214, 10, 0.12); }
.brand-name { font-size: 15px; letter-spacing: -0.01em; }
.brand-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.brand-sub { color: var(--text-dim); font-weight: 500; font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 10px; font-family: inherit; font-weight: 600;
  font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: #2c323c; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), #ffaa00);
  color: #1a1500; display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
}

/* Main */
.main { padding: 28px 28px 96px; }

.page-head { margin-bottom: 20px; }

/* Tab navigation */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { background: var(--surface-3); color: var(--text); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Manager NPS per-quarter breakdown */
.quarter-block {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.quarter-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.quarter-block h3 .pct {
  font-size: 16px; font-weight: 700;
  color: var(--yellow);
}
.quarter-block .quarter-meta {
  color: var(--text-mute); font-size: 11px; margin-bottom: 10px;
}
.rating-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
}
.rating-row:first-of-type { border-top: 0; }
.rating-row .name { font-weight: 500; }
.rating-row .pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.pill.above { background: var(--green-soft); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.3); }
.pill.meets { background: rgba(77, 141, 246, 0.14); color: var(--blue); border: 1px solid rgba(77, 141, 246, 0.3); }
.pill.below { background: var(--red-soft); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }
.rating-empty { color: var(--text-mute); font-size: 12px; padding: 8px 0; }

/* Manager NPS columns (Above / Meets / Below) */
.rating-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
.rating-column {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 80px;
}
.rating-column-above { border-top: 3px solid var(--green); }
.rating-column-meets { border-top: 3px solid var(--blue); }
.rating-column-below { border-top: 3px solid var(--red); }
.rating-column-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.rating-icon { font-size: 12px; }
.rating-label { flex: 1; }
.rating-count {
  background: var(--surface-3);
  color: var(--text);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.person-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  transition: transform .12s, border-color .12s;
}
.person-card:hover { transform: translateX(2px); border-color: var(--border); }
.person-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.person-avatar-above {
  background: var(--green-soft);
  color: var(--green);
  box-shadow: inset 0 0 0 1.5px var(--green);
}
.person-avatar-meets {
  background: rgba(77, 141, 246, 0.18);
  color: var(--blue);
  box-shadow: inset 0 0 0 1.5px var(--blue);
}
.person-avatar-below {
  background: var(--red-soft);
  color: var(--red);
  box-shadow: inset 0 0 0 1.5px var(--red);
}
.person-info { min-width: 0; flex: 1; }
.person-name { font-weight: 600; font-size: 13px; }
.person-note { color: var(--text-mute); font-size: 11px; margin-top: 2px; }
.person-empty {
  color: var(--text-mute);
  text-align: center;
  padding: 18px 0;
  font-style: italic;
  font-size: 12px;
}

@media (max-width: 900px) {
  .rating-columns { grid-template-columns: 1fr; }
}

/* ============ Print stylesheet (Share → PDF) ============ */
@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --surface-3: #f0f0f0;
    --border: #d0d0d0;
    --border-soft: #e6e6e6;
    --text: #0b0d10;
    --text-dim: #4b5563;
    --text-mute: #6b7280;
  }
  body { background: white; color: black; }
  .topbar { position: static; box-shadow: none; }
  .topbar-right .btn,
  .topbar-right .avatar { display: none; }
  .tabs { display: none; }
  .tab-panel { display: block !important; page-break-before: always; }
  .tab-panel:first-of-type { page-break-before: auto; }
  details { open: true; }
  details > summary { list-style: none; cursor: default; }
  details:not([open]) > summary ~ * { display: block !important; }
  /* Force all details to render their content for printing */
  details > div, details > p { display: block !important; }
  .panel { box-shadow: none; break-inside: avoid; }
  .kpi-card { box-shadow: none; break-inside: avoid; }
  .alerts-list, .open-positions, .rating-columns { break-inside: avoid; }
  canvas { max-width: 100%; }
  a { color: var(--blue) !important; text-decoration: underline; }
  /* Hide interactive helpers in print */
  .position-chevron { display: none; }
  .position-row.is-expanded .position-detail,
  .position-row .position-detail { display: block !important; }
}

/* NPS categories */
.nps-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.nps-pill.promoter { background: var(--green-soft); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.3); }
.nps-pill.passive { background: rgba(255, 214, 10, 0.12); color: var(--yellow); border: 1px solid rgba(255, 214, 10, 0.3); }
.nps-pill.detractor { background: var(--red-soft); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }

/* Probation detail */
.probation-detail {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.probation-stat {
  text-align: center; padding: 18px; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.probation-stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.probation-stat-label { color: var(--text-mute); font-size: 11px; margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }

code {
  background: var(--surface-3); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, monospace; font-size: 11px;
}

/* Select dropdown */
.select-control {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 32px 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3e%3cpath fill='%23a1a7b3' d='M0 0l5 6 5-6z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 180px;
}
.select-control:hover { border-color: #2c323c; }
.select-control:focus { outline: none; border-color: var(--yellow); }
.eyebrow {
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-mute); margin: 0 0 8px; font-weight: 600;
}
h1 { font-size: 30px; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h2 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: -.01em; }

.updated { color: var(--text-mute); font-size: 12px; }

/* KPI cards */
.kpis {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.kpi-card:hover { border-color: var(--border); transform: translateY(-1px); }
.kpi-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.kpi-card-link:hover {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow-soft);
}
.kpi-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kpi-label { color: var(--text-dim); font-size: 12px; font-weight: 500; }
.kpi-source {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-mute); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 999px;
}
.kpi-value { display: flex; align-items: baseline; gap: 4px;
  font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.kpi-value.good { color: var(--green); }
.kpi-value.bad { color: var(--red); }
.kpi-value.warn { color: var(--yellow); }
.kpi-unit { font-size: 13px; color: var(--text-dim); font-weight: 500; }
.kpi-trend { margin-top: 8px; font-size: 11px; color: var(--text-mute); }
.kpi-trend.bad { color: var(--red); }
.kpi-trend.good { color: var(--green); }
.kpi-trend.warn { color: var(--yellow); }

/* Generic cell colorization (apply to <td> cells) */
.cell-good { color: var(--green); font-weight: 600; }
.cell-bad { color: var(--red); font-weight: 600; }
.cell-warn { color: var(--yellow); font-weight: 600; }

/* Trend arrow for value time (down = green per spec) */
.trend-arrow { font-size: 10px; margin-left: 4px; font-weight: 700; }
.trend-arrow.down { color: var(--green); }
.trend-arrow.up { color: var(--red); }
.trend-arrow.flat { color: var(--text-mute); }

/* Daily bar */
.daily-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 22px;
}
.daily-item {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.daily-item.daily-alert { border-color: rgba(248, 113, 113, 0.35); background: linear-gradient(180deg, rgba(248,113,113,0.06), var(--surface)); }
.daily-label { color: var(--text-dim); font-size: 12px; font-weight: 500; }
.daily-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.daily-alert .daily-value { color: var(--red); }
.daily-sub { color: var(--text-mute); font-size: 11px; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 14px;
}
.panel-sub { color: var(--text-dim); font-size: 12px; margin: 4px 0 0; }

.badge {
  background: var(--surface-3);
  color: var(--text-dim);
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}

.legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 11px; color: var(--text-dim);
  align-items: center;
}
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.dot-yellow { background: var(--yellow); }
.dot-blue { background: var(--blue); }
.dot-blue-soft { background: var(--blue-soft); }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-orange { background: var(--orange); }
.dot-purple { background: var(--purple); }
.dot-pink { background: var(--pink); }
.dot-teal { background: var(--teal); }

.chart-wrap { height: 260px; position: relative; }
.chart-wrap-tall { height: 320px; }

/* Grid (2-col panels) */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }

/* Open positions */
.open-positions { display: flex; flex-direction: column; gap: 10px; }
.position-row {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.position-summary {
  display: grid;
  grid-template-columns: 2fr 80px 80px 70px 70px 1fr 30px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .15s;
}
.position-summary:hover { background: var(--surface-3); }
.position-title { font-weight: 600; font-size: 14px; }
.position-title-link {
  font-weight: 600; font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
}
.position-title-link:hover { color: var(--yellow); }
.position-meta { color: var(--text-mute); font-size: 11px; }
.position-stat { text-align: center; }
.position-stat-value { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.position-stat-label { color: var(--text-mute); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.position-funnel { display: flex; gap: 4px; align-items: center; height: 22px; }
.funnel-bar {
  height: 22px;
  background: var(--blue-soft);
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  font-size: 10px; font-weight: 600; color: #0b0d10;
  min-width: 22px;
}
.position-chevron {
  color: var(--text-mute);
  font-size: 18px;
  transition: transform .2s;
}
.position-row.is-expanded .position-chevron { transform: rotate(90deg); }
.position-detail {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border-soft);
}
.position-row.is-expanded .position-detail { display: block; }
.stage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 12px;
}
.stage-table th, .stage-table td {
  text-align: left; padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.stage-table th { color: var(--text-mute); font-weight: 500; font-size: 11px; }
.stage-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.alert-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--red-soft); color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px; font-weight: 600;
}

/* Alerts list */
.alerts-list { display: flex; flex-direction: column; gap: 8px; }
.alert-row {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
}
.alert-row .candidate { font-weight: 600; }
.alert-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--text-mute);
  transition: color .15s, border-color .15s;
}
.alert-link:hover {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}
.alert-row .role { color: var(--text-dim); font-size: 12px; }
.alert-row .stage { color: var(--text-dim); font-size: 12px; }
.alert-row .days {
  text-align: right;
  font-weight: 700; color: var(--red); font-size: 14px;
}
.alerts-empty { color: var(--text-mute); padding: 20px; text-align: center; font-size: 13px; }

/* Value time tables */
.value-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.value-table thead th {
  position: sticky; top: 0;
  text-align: right;
  color: var(--text-mute);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
}
.value-table thead th:first-child { text-align: left; }
.value-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.value-table tbody td:first-child { text-align: left; font-weight: 500; }
.value-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.value-table tbody tr:last-child td { border-bottom: 0; font-weight: 600; }
.value-cell { color: var(--text); }
.value-cell.zero { color: var(--text-mute); }

.table-wrap { max-height: 380px; overflow-y: auto; }

.footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-mute);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .daily-bar { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .position-summary { grid-template-columns: 1fr 60px 60px 60px 60px 30px; }
  .position-funnel { display: none; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .daily-bar { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}
