/*!
 * bq-dropdown 1.0.0 (2026-10-26) — company-KPI's field and menu, for any <select>.
 * Measurements are company-KPI/css/styles.css's (.ck-dropdown-container,
 * .ts-control, .ts-dropdown, .ck-chart-type-menu); see bq-dropdown.js.
 * Colours are custom properties so a page with its own theme (the portfolio
 * app's dark mode) can restate them; the defaults are the KPI tool's.
 */
.bqdd {
  --bqdd-bg: #fff;
  --bqdd-ink: #0b1f2e;
  --bqdd-text: #37485a;
  --bqdd-muted: #6b7a89;
  --bqdd-faint: #97a4b2;
  --bqdd-line: #eaeff4;
  --bqdd-line-mid: #dfe6ed;
  --bqdd-line-strong: #cfd9e3;
  --bqdd-tint: #f7fafc;
  --bqdd-tint-2: #f1f6fa;
  --bqdd-blue: #00529b;
  --bqdd-blue-mid: #217ab4;
  --bqdd-blue-soft: rgba(0, 82, 155, .08);
  --bqdd-disabled: #f8f9fa;
  --bqdd-shadow: 0 2px 4px rgba(11, 31, 46, .06), 0 10px 24px rgba(11, 31, 46, .13);

  position: relative;
  display: inline-flex;
  vertical-align: middle;
  min-width: 0;
  max-width: 100%;
  font-family: inherit;
}

/* The native select stays in the DOM as the source of truth, out of sight. */
.bqdd .bqdd-native {
  position: absolute !important;
  left: 0; bottom: 0;
  width: 1px !important; height: 1px !important;
  min-width: 0 !important;
  margin: 0 !important; padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden;
}

/* ── The field: .ck-dropdown-container + .ts-control ── */
.bqdd-btn {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 34px;
  min-width: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background: var(--bqdd-bg);
  border: 1px solid var(--bqdd-line-mid);
  border-radius: 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .1px;
  line-height: 1;
  color: var(--bqdd-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.bqdd-btn:hover { border-color: var(--bqdd-line-strong); }
.bqdd-btn:focus { outline: none; }
.bqdd-btn:focus-visible,
.bqdd.is-open .bqdd-btn {
  border-color: var(--bqdd-blue-mid);
  box-shadow: 0 0 0 3px var(--bqdd-blue-soft);
}

/* The KPI toolbar's micro-label: 10px/700 uppercase on a tint. */
.bqdd-label {
  display: flex;
  align-items: center;
  flex: none;
  padding: 0 9px;
  background: var(--bqdd-tint);
  border-right: 1px solid var(--bqdd-line);
  border-radius: 5px 0 0 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .85px;
  text-transform: uppercase;
  color: var(--bqdd-faint);
  white-space: nowrap;
}
.bqdd-value {
  flex: 1 1 auto;
  min-width: 0;
  align-self: center;
  padding: 0 6px 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bqdd-value.is-placeholder { color: var(--bqdd-faint); font-weight: 500; }
.bqdd-chev {
  flex: none;
  align-self: center;
  margin: 0 11px 0 2px;
  color: var(--bqdd-muted);
  transition: transform .18s ease, color .15s ease;
}
.bqdd.is-open .bqdd-chev { transform: rotate(180deg); color: var(--bqdd-blue); }

.bqdd.is-disabled .bqdd-btn {
  background: var(--bqdd-disabled);
  color: var(--bqdd-faint);
  cursor: not-allowed;
}
.bqdd.is-disabled .bqdd-btn:hover { border-color: var(--bqdd-line-mid); }

/* Inside a shell that draws its own frame (.ck-dropdown-container,
   .bq-pp-field-shell): no second border, and the menu spans the shell. */
.bqdd-host { position: relative; }
.bqdd--bare { position: static; flex: 1 1 auto; align-self: stretch; }
.bqdd--bare .bqdd-btn,
.bqdd--bare .bqdd-btn:hover,
.bqdd--bare.is-open .bqdd-btn,
.bqdd--bare .bqdd-btn:focus-visible {
  height: 100%;
  background: transparent;
  border: 0;
  border-radius: 0 6px 6px 0;
  box-shadow: none;
}
.bqdd-host.is-active {
  border-color: var(--bqdd-blue-mid, #217ab4) !important;
  box-shadow: 0 0 0 3px rgba(0, 82, 155, .08) !important;
}

/* A compact field for toolbars and table rows. */
.bqdd--sm .bqdd-btn { height: 30px; font-size: 12px; }
.bqdd--sm .bqdd-value { padding-left: 9px; }
.bqdd--sm .bqdd-chev { margin-right: 9px; }

/* ── The menu: .ts-dropdown ── */
.bqdd-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 300;
  min-width: 100%;
  max-width: min(420px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 4px;
  background: var(--bqdd-bg);
  border: 1px solid var(--bqdd-line-mid);
  border-radius: 6px;
  box-shadow: var(--bqdd-shadow);
  text-align: left;
}
.bqdd-menu[hidden] { display: none; }
.bqdd--bare .bqdd-menu { left: -1px; right: -1px; min-width: 0; max-width: none; }
.bqdd.is-up .bqdd-menu { top: auto; bottom: calc(100% + 5px); }

.bqdd-list {
  max-height: min(330px, 55vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
}
.bqdd-opt {
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--bqdd-text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bqdd-opt.is-active { background: var(--bqdd-tint-2); color: var(--bqdd-ink); }
.bqdd-opt.is-selected { font-weight: 700; color: var(--bqdd-blue); }
.bqdd-opt.is-disabled { color: var(--bqdd-faint); cursor: default; background: none; }
.bqdd-group {
  padding: 10px 10px 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .85px;
  text-transform: uppercase;
  color: var(--bqdd-faint);
}
.bqdd-group:first-child { padding-top: 6px; }
.bqdd-empty { padding: 10px; font-size: 12.5px; color: var(--bqdd-faint); }

.bqdd-search { padding: 2px 2px 6px; border-bottom: 1px solid var(--bqdd-line); margin-bottom: 4px; }
.bqdd-search input {
  display: block;
  width: 100%;
  height: 30px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 9px;
  background: var(--bqdd-bg);
  border: 1px solid var(--bqdd-line-mid);
  border-radius: 5px;
  box-shadow: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--bqdd-ink);
  outline: none;
}
.bqdd-search input:focus { border-color: var(--bqdd-blue-mid); }

/* iOS zooms the page on focus of any field under 16px. */
@media (pointer: coarse) {
  .bqdd-search input { font-size: 16px !important; height: 36px; }
  .bqdd-opt { padding: 10px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .bqdd-chev, .bqdd-btn { transition: none; }
}
@media print {
  .bqdd-menu { display: none !important; }
  .bqdd-chev { display: none; }
}
