/* ╔══════════════════════════════════════════════════════════════╗
   ║  YETI REPORT KIT — Shared Report Controls                     ║
   ║  Version: 1.6.0 (2026-07-14)                                  ║
   ║                                                                ║
   ║  One shared contract for the controls every staff-v6 report   ║
   ║  repeats: header context dropdowns, the report-card control    ║
   ║  row, Search, view tabs, and segmented value controls.        ║
   ║                                                                ║
   ║  Ownership boundaries (do NOT blur them):                     ║
   ║   • This file owns shared CONTROL layout/size/focus only.     ║
   ║   • yeti-report.css keeps the dropdown menu/option/keyboard   ║
   ║     rules (.yr-dd-menu…), export menu (.yr-export-*,          ║
   ║     .yr-opt-*, .yr-menu-divider) and .is-hidden. Never        ║
   ║     duplicate those here.                                     ║
   ║   • Page stylesheets keep tables, charts, drawers, badges     ║
   ║     and report-specific presentation. A page sheet must not   ║
   ║     redefine the shared control height/font/border/focus.     ║
   ║                                                                ║
   ║  Loaded shell-wide via YetiReportAsset (after yeti-report.css)║
   ║  and allow-listed in ajax-nav.js SHELL_CSS_PATHS — this file  ║
   ║  must never be tracked/retired as page CSS.                   ║
   ║                                                                ║
   ║  Behavior: YR.initReportTabs (tabs) + YR.initDropdown         ║
   ║  (dropdowns) in yeti-report.js. Tab panels rely on the HTML   ║
   ║  `hidden` attribute as the visibility source of truth.        ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ─── §1 Shared control tokens ─────────────────────────────────── */
.yr-scope {
  --yr-report-control-h: 40px;
  --yr-report-control-radius: 9px;
  --yr-report-control-gap: 10px;
  --yr-report-context-w: 220px;
  --yr-report-filter-w: 180px;
  --yr-report-search-w: 220px;
  --yr-report-control-font: 13px;
  --yr-report-label-font: 10.5px;
  --yr-report-focus: 0 0 0 3px rgba(18, 160, 221, .18);
}

/* ─── §2 Header context group (dataset/identity selectors) ─────── */
.yr-report-context {
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 14px;
  flex: 0 1 auto;
  min-width: 0;
}

.yr-report-context-field {
  display: grid;
  gap: 5px;
  width: min(var(--yr-report-context-w), 28vw);
  min-width: 180px;
}

.yr-report-control-label {
  font-size: var(--yr-report-label-font);
  font-weight: 700;
  letter-spacing: .10em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--yr-text-muted);
}

/* ─── §3 Report-card header + control row ──────────────────────── */
.yr-report-card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--yr-card-border);
}

.yr-report-card-title {
  flex: 1 1 220px;
  min-width: 0;
}

.yr-report-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--yr-report-control-gap);
  flex-wrap: wrap;
  margin-left: auto;
}

.yr-report-filters {
  display: flex;
  align-items: center;
  gap: var(--yr-report-control-gap);
  flex-wrap: wrap;
}

.yr-report-controls .yr-dd-wrap {
  width: var(--yr-report-filter-w);
  flex: 0 0 var(--yr-report-filter-w);
}

/* ─── §4 Shared Search ─────────────────────────────────────────── */
/* Accessible names in the Search markup use the kit's existing
   .yr-sr-only utility (yeti-report.css) — do not add a second one. */

.yr-report-search {
  position: relative;
  display: block;
  width: var(--yr-report-search-w);
  flex: 0 1 var(--yr-report-search-w);
}

.yr-report-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--yr-text-muted);
  pointer-events: none;
}

.yr-report-search-input {
  width: 100%;
  height: var(--yr-report-control-h);
  padding: 0 34px 0 38px;
  border: 1px solid var(--yr-card-border);
  border-radius: var(--yr-report-control-radius);
  background: var(--yr-card-bg);
  color: var(--yr-text-primary);
  font-family: var(--yr-font);
  font-size: var(--yr-report-control-font);
}

.yr-report-search-input:focus-visible {
  outline: 0;
  border-color: var(--yr-blue);
  box-shadow: var(--yr-report-focus);
}

/* ─── §5 Dropdown size normalization (behavior stays in the kit) ─ */
.yr-report-context .yr-dd-button,
.yr-report-controls .yr-dd-button {
  min-height: var(--yr-report-control-h);
  padding: 0 14px;
  border-radius: var(--yr-report-control-radius);
  font-size: var(--yr-report-control-font);
}

/* ─── §6 View tabs + segmented value controls ──────────────────── */
/* Table/Graph is a TAB relationship (role="tablist", aria-selected,
   exclusive panels). Metric/date-range pickers change a value inside
   the selected view — they are segmented button groups (aria-pressed),
   never tablists. Same skin, different semantics. */
.yr-report-tabs,
.yr-report-segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--yr-report-control-radius);
  background: #eef2f6;
}

.yr-report-tab,
.yr-report-segment-button {
  min-height: calc(var(--yr-report-control-h) - 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--yr-text-muted);
  font-family: var(--yr-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.yr-report-tab svg,
.yr-report-segment-button svg {
  width: 13px;
  height: 13px;
}

.yr-report-tab:hover,
.yr-report-segment-button:hover {
  color: var(--yr-text-primary);
}

.yr-report-tab[aria-selected="true"],
.yr-report-segment-button[aria-pressed="true"] {
  background: var(--yr-card-bg);
  color: var(--yr-text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px var(--yr-card-border);
}

.yr-report-tab:focus-visible,
.yr-report-segment-button:focus-visible {
  outline: 0;
  box-shadow: var(--yr-report-focus);
}

/* `hidden` is the visibility source of truth for tab panels — beat any
   page-level display rule on the panel element. */
.yr-report-panel[hidden] {
  display: none !important;
}

/* ─── §7 Responsive contract ───────────────────────────────────── */
@media (max-width: 980px) {
  .yr-report-context {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .yr-report-context-field {
    flex: 1 1 180px;
    width: auto;
  }

  .yr-report-controls {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .yr-report-context {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .yr-report-context-field {
    width: 100%;
    min-width: 0;
  }

  .yr-report-search {
    width: 100%;
    flex-basis: 100%;
  }

  /* ≥16px input text prevents mobile-browser auto-zoom on focus. */
  .yr-report-search-input {
    font-size: 16px;
  }

  /* ≥44px touch targets on small screens. */
  .yr-report-context .yr-dd-button,
  .yr-report-controls .yr-dd-button,
  .yr-report-controls .yr-btn {
    min-height: 44px;
  }

  .yr-report-tab,
  .yr-report-segment-button {
    min-height: 38px;
  }

  /* >3 views: the rail scrolls inside itself, never the page. */
  .yr-report-tabs {
    max-width: 100%;
    overflow-x: auto;
  }
}
