/* Shared controls: native pickers, consistent presentation across every page. */
:root {
  --control-ink: #202a49;
  --control-muted: #65708b;
  --control-border: #d8ddee;
  --control-accent: #6157cf;
}
body select:not([multiple]):not([size]),
body select[size="1"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 56px;
  min-height: 56px;
  padding: 0 48px 0 16px;
  border: 1px solid var(--control-border);
  border-radius: 13px;
  background-color: #fcfcff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%235e58a1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 16px center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  box-shadow: 0 2px 4px #19223b03;
  color: var(--control-ink);
  color-scheme: light;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: normal;
  text-align: left;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
body select:not([multiple]):not([size]):hover:not(:disabled),
body select[size="1"]:hover:not(:disabled) {
  border-color: #aaa4e1;
  background-color: #f8f7ff;
}
body select:not([multiple]):not([size]):focus,
body select[size="1"]:focus {
  outline: 2px solid #6258cf;
  outline-offset: 2px;
  border-color: #8076dc;
  background-color: #fff;
  box-shadow: 0 0 0 5px #7164db12;
}
body select:not([multiple]):disabled {
  color: #68728a;
  background-color: #eff1f6;
  border-color: #dde1eb;
  box-shadow: none;
  opacity: .75;
  cursor: not-allowed;
}
body select option { background: #fff; color: var(--control-ink); }
body select:not([multiple])[aria-invalid="true"] { border-color: #b84561; }
body .hub-table select { min-width: 145px; }
body input[type="checkbox"], body input[type="radio"] { accent-color: var(--control-accent); }

/* Filter panels use the same hierarchy for browsing cases and resources. */
.filter-panel {
  position: relative;
  padding: 28px;
  border: 1px solid #dde0ef;
  border-radius: 24px;
  background: linear-gradient(120deg,#fff 45%,#f4f2ff);
  box-shadow: 0 12px 40px #28244c06, 0 1px 3px #28244c03;
  margin-bottom: 32px;
  min-width: 0;
}
.filter-panel [hidden] { display: none !important; }
.filter-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.filter-panel-intro { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.filter-panel-icon {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #e0dcf6;
  border-radius: 13px;
  background: #f0edfc;
  color: #6a54c6;
}
.filter-panel-icon svg { width: 22px; height: 22px; }
.filter-panel .filter-panel-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -.025em;
  color: var(--control-ink);
}
.filter-panel .filter-panel-intro p {
  margin: 0;
  color: var(--control-muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
}
.filter-panel .filter-result-count {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #d4e7e5;
  border-radius: 999px;
  background: #f0faf8;
  color: #35605d;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  white-space: nowrap;
}
.filter-result-count strong { font-size: 17px; color: #176d64; font-variant-numeric: tabular-nums; }
.filter-panel .case-filters,
.filter-panel .resource-filter-controls {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto;
  align-items: end;
  gap: 16px;
}
.filter-panel .resource-filter-controls { grid-template-columns: minmax(0,1fr) auto; }
.filter-panel .case-filters label,
.filter-panel .hub-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  color: #485270;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  text-align: left;
}
body .filter-panel select[data-filter-active="true"] {
  border-color: #aaa0e7;
  background-color: #f2effe;
  color: #4f419d;
}
.filter-panel .filter-reset {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 18px;
  border: 1px solid #ddd8ef;
  border-radius: 13px;
  background: #f3f0fd;
  color: #5745a4;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
}
.filter-reset svg { width: 18px; height: 18px; flex: 0 0 18px; }
.filter-panel .filter-reset:hover:not(:disabled) { border-color: #a496d6; background: #eae4fb; }
.filter-panel .filter-reset:disabled { background: #f4f5f9; border-color: #e4e7ee; color: #7b8295; opacity: 1; cursor: default; }
.filter-panel .filter-reset:focus-visible,
.filter-panel .filter-chip:focus-visible { outline: 2px solid #6258cf; outline-offset: 3px; }
.filter-selection {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e5e3f0;
}
.filter-selection-label { margin-right: 4px; font-size: 12px; color: var(--control-muted); }
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 100%;
  min-height: 40px;
  border: 1px solid #dcd5f4;
  border-radius: 10px;
  padding: 8px 10px 8px 13px;
  background: #ede8fc;
  color: #51418e;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
}
.filter-chip span { overflow-wrap: anywhere; }
.filter-chip svg { width: 16px; height: 16px; flex: 0 0 16px; }
.filter-chip:hover { background: #e2daf7; border-color: #bfb0e4; }
.resource-search-wrap { position: relative; display: block; }
.resource-search-wrap > svg { position: absolute; top: 18px; left: 16px; width: 20px; height: 20px; color: #79749c; pointer-events: none; }
.filter-panel .hub-search {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: none;
  height: 56px;
  padding: 0 16px 0 47px;
  border: 1px solid var(--control-border);
  border-radius: 13px;
  background: #fcfcff;
  color: var(--control-ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  box-shadow: 0 2px 4px #19223b03;
}
.filter-panel .hub-search::placeholder { color: #767e95; opacity: 1; }
.filter-panel .hub-search:hover { border-color: #aaa4e1; }
.filter-panel .hub-search:focus { outline: 2px solid #6258cf; outline-offset: 2px; border-color: #8076dc; background: #fff; }
#resource-search::-webkit-search-cancel-button { -webkit-appearance: none; }
.cases-page .cases-empty,
.resource-empty {
  grid-column: 1/-1;
  margin: 0;
  padding: 40px 24px;
  border: 1px dashed #c7c4df;
  border-radius: 20px;
  background: #f7f6fd;
  color: #606784;
  font-size: 16px;
  line-height: 1.7;
  text-align: center;
}
/* Choice groups in the diagnostic and tools share the same selected state. */
.hub-form .hub-mode { gap: 8px; padding: 6px; background: #f3f3fa; border: 1px solid #e3e3ef; border-radius: 17px; }
.hub-form .hub-mode label { flex: 1 1 180px; min-height: 50px; padding: 12px 16px; border-radius: 12px; border-color: transparent; font-size: 14px; color: #646b85; }
.hub-form .hub-mode label:has(input:checked) { border-color: #b2a7e6; background: #fff; color: #514391; box-shadow: 0 3px 10px #4f357714; }
.hub-form .hub-mode label:has(input:focus-visible) { outline: 2px solid #6258cf; outline-offset: 2px; }
body .choice-grid .choice,
body .process-choices .choice { border-radius: 13px; min-height: 50px; transition: border-color .18s ease, background-color .18s ease; }
body .choice-grid .choice:has(input:checked),
body .process-choices .choice:has(input:checked) { border-color: #a99ddd; background: #f2effc; }
body .choice-grid .choice:has(input:focus-visible),
body .process-choices .choice:has(input:focus-visible) { outline: 2px solid #6258cf; outline-offset: 3px; }

@media (max-width: 900px) {
  .filter-panel-heading { flex-wrap: wrap; }
  .filter-panel .case-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-panel .case-filters .filter-reset { grid-column: 1/-1; justify-self: start; }
}
@media (max-width: 600px) {
  .filter-panel { padding: 20px; border-radius: 20px; margin-bottom: 24px; }
  .filter-panel-heading { gap: 16px; margin-bottom: 22px; }
  .filter-panel-intro { gap: 11px; }
  .filter-panel-icon { flex-basis: 36px; width: 36px; height: 36px; border-radius: 11px; }
  .filter-panel .filter-panel-heading h2 { font-size: 17px; }
  .filter-panel .filter-panel-intro p { font-size: 13px; }
  .filter-panel .case-filters,
  .filter-panel .resource-filter-controls { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .filter-panel .case-filters .filter-reset { justify-self: stretch; }
  .filter-selection-label { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  body select, .filter-reset, .choice-grid .choice, .process-choices .choice { transition: none !important; }
}
@media (forced-colors: active) {
  body select:not([multiple]):not([size]), body select[size="1"] { -webkit-appearance: auto; appearance: auto; background-image: none; }
  .filter-panel, .filter-chip, .filter-panel .filter-reset, .filter-panel .filter-result-count { border-color: ButtonText; }
}
