/* ==========================================================================
   BetterLead design layer
   Loaded AFTER MudBlazor.min.css so equal-specificity rules win. Tokens mirror
   Theme/BetterLeadTheme.cs (and, in plain CSS, HtmlReportTemplate for the PDF).
   Type stacks are system fonts on purpose: the deployment target may have no
   internet egress, so a font CDN would silently fall back.
   ========================================================================== */

:root {
  --bl-ink: #131A26;
  --bl-navy-900: #16294A;
  --bl-navy-700: #1F3864;
  --bl-navy-500: #2E5395;
  --bl-azure: #2F6FD0;

  --bl-canvas: #F5F7FA;
  --bl-surface: #FFFFFF;
  --bl-surface-alt: #EEF2F8;
  --bl-hairline: #DCE3ED;
  --bl-muted: #5A6B85;
  --bl-faint: #8C9AB0;

  --bl-positive: #1C7A4D;
  --bl-caution: #B0740A;
  --bl-critical: #B0322C;

  --bl-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --bl-display: Cambria, Georgia, "Times New Roman", serif;

  --bl-radius: 5px;
  --bl-radius-lg: 8px;
}

/* ---- base ---------------------------------------------------------------- */

body {
  background: var(--bl-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(47, 111, 208, .18);
}

/* A visible, branded focus ring — keyboard users should never have to guess. */
:focus-visible {
  outline: 2px solid var(--bl-azure);
  outline-offset: 2px;
}

/* Figures that sit in columns must line up. */
.bl-num,
.mud-table-cell.bl-num,
table.bl-data td {
  font-variant-numeric: tabular-nums;
}

/* ---- boot splash and the transport error banner -------------------------- */

.bl-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  height: 100vh;
  background: var(--bl-canvas);
  color: var(--bl-navy-700);
  font-family: var(--bl-ui);
}

.bl-splash-word {
  font-family: var(--bl-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.bl-splash-bar {
  width: 168px;
  height: 3px;
  border-radius: 2px;
  background: var(--bl-hairline);
  overflow: hidden;
}

.bl-splash-bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: var(--bl-navy-500);
  animation: bl-slide 1.15s ease-in-out infinite;
}

@keyframes bl-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  .bl-splash-bar::after { animation: none; width: 100%; opacity: .5; }
}

#blazor-error-ui {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  padding: 12px 20px;
  background: #FFF6E5;
  border-top: 3px solid var(--bl-caution);
  box-shadow: 0 -2px 12px rgba(19, 26, 38, .12);
  font-family: var(--bl-ui);
  font-size: .85rem;
  color: #5A4406;
}

#blazor-error-ui a { color: #7A3D00; }

/* ---- app bar and navigation --------------------------------------------- */

.mud-appbar.mud-appbar-fixed-top {
  /* A hairline instead of a drop shadow: crisper against the canvas. */
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .12);
  background-image: linear-gradient(90deg, var(--bl-navy-900) 0%, #1B3157 100%);
}

.bl-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.bl-brand-mark {
  display: block;
  flex: none;
}

.bl-brand-word {
  font-family: var(--bl-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.005em;
  line-height: 1;
}

.bl-brand-tag {
  font-family: var(--bl-ui);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .62);
  line-height: 1;
  margin-top: 3px;
}

/* Nav items read as tabs: the active one is underlined and fully opaque. */
.bl-nav .mud-button-root {
  color: rgba(255, 255, 255, .74);
  border-radius: 0;
  padding: 0 12px;
  min-width: 0;
  border-bottom: 2px solid transparent;
  transition: color .12s ease, border-color .12s ease, background-color .12s ease;
}

.bl-nav .mud-button-root:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.bl-nav .mud-button-root.bl-nav-active {
  color: #fff;
  border-bottom-color: #7FA6E8;
}

/* ---- page header pattern ------------------------------------------------- */

.bl-page-header {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--bl-hairline);
}

.bl-page-header-text { min-width: 0; flex: 1 1 320px; }

.bl-eyebrow {
  font-family: var(--bl-ui);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--bl-faint);
  margin-bottom: 6px;
}

.bl-page-title {
  font-family: var(--bl-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--bl-ink);
  text-wrap: balance;
  margin: 0;
}

.bl-page-sub {
  font-family: var(--bl-ui);
  font-size: .85rem;
  color: var(--bl-muted);
  margin-top: 6px;
  max-width: 68ch;
}

.bl-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- surfaces ----------------------------------------------------------- */

.bl-card {
  background: var(--bl-surface);
  border: 1px solid var(--bl-hairline);
  border-radius: var(--bl-radius-lg);
  box-shadow: none;
}

.bl-card-pad { padding: 18px 20px; }

.bl-section-label {
  font-family: var(--bl-ui);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--bl-faint);
}

/* KPI figure: the number is the point, so give it room and tighten the label. */
.bl-kpi {
  font-family: var(--bl-display);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--bl-ink);
  font-variant-numeric: tabular-nums;
}

.bl-kpi-small {
  font-size: .8rem;
  font-weight: 400;
  color: var(--bl-muted);
  font-family: var(--bl-ui);
}

.bl-kpi-foot {
  font-size: .75rem;
  color: var(--bl-muted);
  margin-top: 6px;
}

/* A left rail encodes the metric's family (upward / self / eNPS). */
.bl-rail { border-left: 3px solid var(--bl-navy-700); }
.bl-rail-alt { border-left: 3px solid var(--bl-navy-500); }
.bl-rail-accent { border-left: 3px solid var(--bl-azure); }

/* ---- tables ------------------------------------------------------------- */

.mud-table-container .mud-table-head .mud-table-cell,
.mud-simple-table thead th {
  font-family: var(--bl-ui);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--bl-muted);
  background: var(--bl-surface-alt);
  border-bottom: 1px solid var(--bl-hairline);
  white-space: nowrap;
}

.mud-simple-table tbody td {
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid #EAEFF6;
}

.mud-simple-table tbody tr:last-child td { border-bottom: none; }

.mud-simple-table tbody tr:hover { background: #F7F9FC; }

/* Wide tables scroll inside their own card; the page never scrolls sideways. */
.bl-scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- chips and pills ---------------------------------------------------- */

.mud-chip.mud-chip-size-small {
  font-family: var(--bl-ui);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .02em;
  height: 21px;
}

.bl-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--bl-hairline);
  background: var(--bl-surface-alt);
  font-family: var(--bl-ui);
  font-size: .6875rem;
  font-weight: 600;
  color: var(--bl-muted);
  white-space: nowrap;
}

.bl-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---- questionnaire ------------------------------------------------------ */

/* One option per line with room to breathe: the labels are sentences now, and the
   options were too close together to pick confidently on a phone (real-use feedback).
   MudRadioGroup lays its options out on `.mud-radio-group` — the flex parent is that
   element, not the outer input control. */
/* The ancestor classes are repeated on purpose: MudBlazor styles this with
   `.mud-input-control.mud-input-control-boolean-input .mud-radio-group`, which outranks a
   two-class selector no matter which stylesheet loads last. */
/* The behaviour being rated is the question itself: it has to outrank the options
   below it, which are five near-identical lines. Doubling up on .mud-typography beats
   MudBlazor's .mud-typography-body1 (0,1,0) without depending on stylesheet order. */
.bl-item-stem.mud-typography {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--bl-ink);
}

.bl-likert .mud-input-control.mud-input-control-boolean-input .mud-radio-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.bl-likert .mud-radio {
  margin: 0;
  padding: 0;
  align-items: center;
}

.bl-likert .mud-radio .mud-typography {
  font-size: .925rem;
  line-height: 1.35;
}

/* The unanswered-item shortcut list inside the submit-blocking warning. */
.bl-missing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bl-missing-link {
  display: flex;
  gap: 8px;
  align-items: baseline;
  /* MudBlazor sets a global `button { justify-content: center }`, which silently centres
     flex content inside any button — the shorter rows drifted right without it. */
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 3px 0;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bl-missing-link:hover { color: var(--bl-azure); }

.bl-missing-attr {
  flex: none;
  font-weight: 600;
  text-decoration: none;
}

/* The card jumped to stays marked until it is answered. */
.bl-item-target {
  border-color: var(--bl-caution);
  box-shadow: 0 0 0 3px rgba(176, 116, 10, .14);
}

/* The "not applicable" option is not part of the agreement scale: set it apart. */
.bl-likert .bl-likert-na {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--bl-hairline);
  width: 100%;
}

.bl-likert .bl-likert-na .mud-typography {
  color: var(--bl-muted);
  font-size: .85rem;
}

/* The 0-10 recommendation scale stays horizontal but wraps, with its ends labelled. */
.bl-scale .mud-input-control.mud-input-control-boolean-input .mud-radio-group {
  display: flex;
  flex-flow: row wrap;
  gap: 6px 14px;
}

.bl-scale .mud-radio { margin: 0; }

.bl-scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: .75rem;
  color: var(--bl-muted);
}

/* ---- misc --------------------------------------------------------------- */

.bl-hint {
  font-size: .8rem;
  color: var(--bl-muted);
}

.bl-footnote {
  font-size: .72rem;
  color: var(--bl-faint);
  text-align: center;
  padding: 26px 0 8px;
}

/* Scrollbars: present but quiet. */
* {
  scrollbar-color: #C4CFDF transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #C4CFDF;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-clip: content-box; background-color: #A9B4C6; }
::-webkit-scrollbar-track { background: transparent; }

@media print {
  .mud-appbar, .bl-page-actions, .mud-snackbar-provider { display: none !important; }
  body { background: #fff; }
}
