/* User Access, on top of the portal's app.css and the MDS tokens (as reporting/static/report.css). */

form.role-form { display: inline-flex; align-items: center; gap: calc(8 * var(--mds-unit)); }
form.role-form select { width: auto; }
/* A select with a chevron 12px from the edge, the same in Chrome and Safari (their native arrow hugs the border). */
select {
  -webkit-appearance: none; appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23424242' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
select:disabled { opacity: 0.6; }
@media (forced-colors: active) { select { appearance: auto; background-image: none; } }
.role-list { margin-top: calc(8 * var(--mds-unit)); display: grid; gap: calc(4 * var(--mds-unit)); }

/* Search and filters in one row, wrapping (as the report's). */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: calc(12 * var(--mds-unit)); }
.filter-bar .field { min-width: 180px; flex: 1 1 180px; }
.filter-bar .field-narrow { flex: 0 0 200px; min-width: 0; }
/* A filter multi-select takes a select's place: a long chosen label is cut with an ellipsis inside the field, and its list
   opens below it, wraps a long choice instead of growing, and is never wider than the screen. Without
   JavaScript the list is no wider than its field; app.js (data-multi-fit) marks the field .multi-fit-ready, lets the list grow to
   480px and adds .is-end, growing it leftwards from the field's right edge, when it would run off the screen's right. */
.filter-bar .field-narrow { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
.filter-bar .filter-multi .multi-summary { min-width: 0; }
.filter-bar .filter-multi [data-multi-values] { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.filter-bar .filter-multi .multi-panel { max-width: 100%; }
.filter-bar .filter-multi.multi-fit-ready .multi-panel { max-width: min(480px, calc(100vw - 32px)); }
.filter-bar .filter-multi .multi-panel.is-end { left: auto; right: 0; }
.filter-bar .filter-multi .check { align-items: flex-start; overflow-wrap: anywhere; }
/* auto-filters.js applies the filters itself, so its button is only for screen readers and Enter. */
.filter-bar.auto-filter-ready > button[type="submit"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The Everyone and org chart bar: the search on its own row, every filter in aligned columns on the rows below. */
.filter-bar-stacked { display: grid; grid-template-columns: minmax(0, 420px) auto 1fr; column-gap: 0; row-gap: 12px; }
.filter-bar-stacked > .field { min-width: 0; }
.filter-bar-stacked > button[type="submit"] { margin-left: 12px; }
.filter-bar-stacked .filter-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.filter-bar-stacked .filter-row .field, .filter-bar-stacked .filter-row .filter-multi { min-width: 0; }

/* ---------- the org chart ---------- */
.org-sync { display: flex; flex-wrap: wrap; align-items: center; gap: calc(8 * var(--mds-unit)); margin-top: calc(4 * var(--mds-unit)); }
.org-sync .inline-form { display: inline-flex; }
.notice-inline-error { color: var(--err-text); background: var(--err-bg); border-radius: var(--radius-s); padding: 0 6px; }
.org-name { font-weight: 600; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: calc(4 * var(--mds-unit)); list-style: none; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "›"; color: var(--text-weak); margin-right: calc(4 * var(--mds-unit)); }
.breadcrumbs [aria-current] { font-weight: 600; }
tr:target { background: var(--blue-weak); }
.github-login { font-family: var(--font-mono, monospace); font-size: 14px; }
.platform-link { white-space: nowrap; }
.portfolio + .portfolio { margin-top: calc(16 * var(--mds-unit)); }
.harbor-chip { white-space: nowrap; }

/* ---------- GitHub access ---------- */
.gh-best { text-decoration: none; }
.gh-level { white-space: nowrap; }
.gh-coverage { margin: calc(8 * var(--mds-unit)) 0; }
.gh-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: calc(8 * var(--mds-unit)); list-style: none; margin: calc(12 * var(--mds-unit)) 0 calc(8 * var(--mds-unit)); padding: 0; }
.gh-kpi a { display: grid; gap: calc(4 * var(--mds-unit)); padding: calc(12 * var(--mds-unit)); border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--text); text-decoration: none; }
.gh-kpi a:hover, .gh-kpi-current a { border-color: var(--text); }
.gh-kpi-count { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gh-bar { display: block; width: 100%; height: 10px; border-radius: 5px; margin-bottom: calc(12 * var(--mds-unit)); }
.gh-bar-admin { fill: #e5464b; }
.gh-bar-maintain { fill: #ff9b4a; }
.gh-bar-write { fill: #ffd23f; }
.gh-bar-triage { fill: #9b7fe0; }
.gh-bar-read { fill: #42b0d5; }
.gh-bar-none { fill: var(--line); }
/* Status (admins): coverage boxes, small tables side by side, label-value rows. */
.status-kpi { display: grid; gap: calc(4 * var(--mds-unit)); padding: calc(12 * var(--mds-unit)); border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: calc(12 * var(--mds-unit)); align-items: start; }
.status-caption { caption-side: top; text-align: left; font-weight: 600; padding-bottom: calc(4 * var(--mds-unit)); }
.status-table th[scope="row"] { width: 260px; font-weight: 600; vertical-align: top; }
.status-list { margin: calc(4 * var(--mds-unit)) 0 0; padding-left: 1.2em; max-height: 240px; overflow: auto; }

/* ---------- the org chart as a dashboard: KPI tiles, charts per access type, cards per direct report ---------- */
/* Severity scale shared with the GitHub page's bars and the tags on Everyone: 5 strongest, 1 weakest. */
.seg-5 { fill: #e5464b; background: #e5464b; }
.seg-4 { fill: #ff9b4a; background: #ff9b4a; }
.seg-3 { fill: #ffd23f; background: #ffd23f; }
.seg-2 { fill: #9b7fe0; background: #9b7fe0; }
.seg-1 { fill: #42b0d5; background: #42b0d5; }
.seg-0 { fill: var(--line-strong); background: var(--line-strong); }
.seg { stroke: var(--surface); stroke-width: 0.4; vector-effect: non-scaling-stroke; }
.breadcrumbs { margin-bottom: calc(8 * var(--mds-unit)); }
.breadcrumbs ol { font-size: 16px; line-height: 24px; }
.section-title { margin: calc(24 * var(--mds-unit)) 0 calc(12 * var(--mds-unit)); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: calc(12 * var(--mds-unit)); margin-bottom: calc(24 * var(--mds-unit)); }
.kpi { display: grid; align-content: start; gap: calc(8 * var(--mds-unit)); padding: calc(16 * var(--mds-unit)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.kpi:has(a.kpi-main:hover), .kpi:focus-within { border-color: var(--text); box-shadow: var(--shadow); }
.kpi-main { display: flex; align-items: center; justify-content: space-between; gap: calc(8 * var(--mds-unit)); color: var(--text); text-decoration: none; }
.kpi-divider { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--line); }
.kpi-split { display: flex; flex-wrap: wrap; gap: calc(4 * var(--mds-unit)) calc(12 * var(--mds-unit)); margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.kpi-split-item { display: inline-flex; align-items: center; gap: calc(4 * var(--mds-unit)); }
.kpi-split a { text-decoration: underline; text-underline-offset: 2px; }
.kpi-split .swatch { width: 10px; height: 10px; border-radius: 50%; }
.kpi-text { display: grid; gap: calc(2 * var(--mds-unit)); }
.kpi-title { font-weight: 600; color: var(--text-weak); }
.kpi-number { font: 400 32px/40px var(--font-head); font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--text-weak); font-size: 13px; }
.ring { width: 64px; height: 64px; flex: none; }
.ring-track { stroke: var(--fill-weak); }
.ring-fill { stroke: var(--blue); }
.ring-text { font: 600 8px var(--font); fill: var(--text); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: calc(24 * var(--mds-unit)); }
.chart-title { font: 600 15px/20px var(--font); margin: 0 0 calc(8 * var(--mds-unit)); }
.stackbar { display: block; width: 100%; height: 20px; border-radius: 10px; background: var(--fill-weak); overflow: hidden; margin-bottom: calc(12 * var(--mds-unit)); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(4 * var(--mds-unit)); }
.legend-row { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: calc(8 * var(--mds-unit)); }
.legend-zero { color: var(--text-weak); }
.legend-n { font-variant-numeric: tabular-nums; }
.swatch { width: 14px; height: 14px; border-radius: 4px; }

.org-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: calc(16 * var(--mds-unit)); }
.org-card { display: grid; align-content: start; gap: calc(8 * var(--mds-unit)); padding: calc(16 * var(--mds-unit)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.org-card:hover, .org-card:focus-within { border-color: var(--text); box-shadow: var(--shadow); }
.org-card-head { margin-bottom: calc(4 * var(--mds-unit)); }
.org-card-name { font: 600 17px/24px var(--font); margin: 0; }
.org-card-title { margin: 0; }
.org-card-people { margin: calc(4 * var(--mds-unit)) 0 0; }
.org-card-count { font: 400 24px/32px var(--font-head); font-variant-numeric: tabular-nums; }
.cover { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: calc(8 * var(--mds-unit)); font-size: 13px; }
.cover-bar { display: block; width: 100%; height: 8px; border-radius: 4px; background: var(--fill-weak); overflow: hidden; }
.cover-n { font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 640px) { .cover { grid-template-columns: 1fr auto; } .cover > .cover-bar { grid-column: 1 / -1; grid-row: 2; } }
.seg-cover { fill: var(--blue); }

/* Admin-only tabs sit after a thin vertical line. The line is drawn on the first admin tab, so it
   can never wrap on its own; the separator element itself takes no space. On narrow screens the
   tabs wrap onto more lines instead of scrolling sideways. */
.tab-bar { flex-wrap: wrap; overflow-x: visible; }
.tab-bar .tab-divider { flex: none; width: 0; height: 0; margin: 0; overflow: hidden; }
.tab-bar .tab-divider + a { position: relative; margin-left: 12px; }
.tab-bar .tab-divider + a::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 10px;
  bottom: 10px;
  border-left: 1px solid var(--line);
}

/* The "Download Excel" menu (org_people.html): app.css styles the action menu's buttons, these are its links. */
.action-menu-panel a {
  display: block; padding: 6px 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; white-space: nowrap;
}
.action-menu-panel a:hover, .action-menu-panel a:focus-visible { background: var(--hover-fill); }
/* A link whose filters are being refreshed (download-menu.js): it would download the previous results. */
.action-menu-panel a[aria-disabled="true"], .action-menu-panel a[aria-disabled="true"]:hover { opacity: 0.5; cursor: not-allowed; background: none; }
