:root {
  --navy: #17365d;
  --blue: #2f75b5;
  --pale: #eef4f9;
}

body { background: #f6f8fb; color: #1f2937; }
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 -12px 20px;
  padding: 24px 30px 18px;
  background: linear-gradient(120deg, var(--navy), var(--blue));
  color: white;
}
.app-header-copy { min-width: 0; }
.app-header h1 { margin: 0 0 4px; font-weight: 650; }
.app-header p { margin: 0; opacity: .9; }
.company-logo {
  display: block;
  width: min(250px, 35vw);
  max-height: 68px;
  margin-left: 575px;
  object-fit: contain;
}
.card {
  border: 0;
  box-shadow: 0 2px 12px rgba(23, 54, 93, .08);
  margin-bottom: 16px;
}
.card-header {
  color: var(--navy);
  font-weight: 650;
  background: var(--pale);
}
.section-heading {
  font-size: 23.6016px;
}
.accordion-title {
  font-size: 18px;
  font-weight: 700;
}
.sidebar { background: white; }
.sidebar-query-status {
  margin-top: 16px;
  margin-bottom: 0;
}
.indicator-selection-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.indicator-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.indicator-table {
  margin: 0;
  table-layout: fixed;
}
.indicator-table th:first-child,
.indicator-table td:first-child {
  width: auto;
  text-align: left;
}
.indicator-table th:not(:first-child),
.indicator-table td:not(:first-child) {
  width: 92px;
  text-align: center;
  vertical-align: middle;
}
.indicator-table > tbody > .indicator-row > td {
  padding-top: 6px;
  padding-bottom: 6px;
}
.indicator-checkbox {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
}
.indicator-checkbox .shiny-input-container,
.indicator-checkbox .form-group,
.indicator-checkbox .checkbox,
.indicator-checkbox label {
  margin-top: 0;
  margin-bottom: 0;
}
.indicator-checkbox .form-check {
  min-height: 0;
  margin: 0;
  padding-left: 1.5rem;
}
.indicator-measure-unavailable {
  opacity: .38;
}
.indicator-measure-unavailable input {
  cursor: not-allowed;
}
#indicator_accordion .accordion-body {
  padding: 0;
}
.indicator-category-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e5eaf0;
  background: #fff;
}
.acs-product-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.acs-product-disabled {
  opacity: .55;
}
.acs-product-disabled input,
.acs-product-disabled label {
  cursor: not-allowed;
}
.acs-product-info-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  cursor: help;
  user-select: none;
}
.acs-product-tooltip {
  position: fixed;
  z-index: 2147483647;
  width: 390px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  padding: 9px 11px;
  border-radius: 5px;
  background: #172b45;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .28);
  color: white;
  font-size: .82rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease;
}
.acs-product-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}
.jurisdiction-picker .selectize-input > .item {
  display: none !important;
}
.jurisdiction-picker .selectize-input {
  min-height: 38px;
}
.jurisdiction-picker .selectize-input > input {
  width: 100% !important;
}
.selected-panel {
  margin: -4px 0 18px;
  padding: 12px;
  border: 1px solid #d7e2ed;
  border-radius: 6px;
  background: #f8fbfe;
}
.selected-panel strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
}
.selected-empty {
  margin: 0 0 8px;
  color: #64748b;
}
.selected-jurisdictions-list {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 4px;
  border: 1px solid #b8c7d9;
  border-radius: 4px;
  background: white;
  color: #1f2937;
}
@media (max-width: 640px) {
  .app-header {
    gap: 16px;
    padding: 20px;
  }
  .company-logo {
    width: min(180px, 38vw);
  }
}

.query-progress-panel {
  margin: 12px 0 4px;
  padding: 12px;
  border: 1px solid #c8d7e6;
  border-radius: 6px;
  background: #f8fbfe;
}
.progress-heading,
.progress-counts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.progress-heading {
  margin-bottom: 8px;
  color: var(--navy);
}
.progress-percent {
  font-weight: 650;
}
.query-progress-panel .progress {
  height: 10px;
  margin-bottom: 8px;
  background: #dce7f1;
}
.query-progress-panel .progress-bar {
  width: 0;
  background: var(--blue);
  transition: width .2s ease;
}
.progress-counts {
  justify-content: flex-start;
  flex-wrap: wrap;
  font-size: .85rem;
  color: #526276;
}
.progress-failed {
  color: #a61b1b;
  font-weight: 650;
}
.progress-current,
.progress-message {
  margin: 8px 0 0;
  font-size: .88rem;
}
.progress-current {
  color: #334155;
  font-weight: 600;
}
.progress-message {
  color: #64748b;
}
.query-progress-panel.progress-complete {
  border-color: #86b99a;
  background: #f1faf4;
}
.query-progress-panel.progress-complete .progress-bar {
  background: #2f855a;
}
.query-progress-panel.progress-error {
  border-color: #df9c9c;
  background: #fff6f6;
}
.query-progress-panel.progress-error .progress-bar {
  background: #c53030;
}




.query-progress-panel {
  margin: 10px 0 4px;
  padding: 10px 11px;
}
.progress-heading {
  margin-bottom: 6px;
}
.progress-heading-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #526276;
  font-size: .82rem;
  white-space: nowrap;
}
.query-progress-panel .progress {
  display: flex;
  height: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}
.query-progress-panel .progress-bar {
  flex: 0 0 auto;
}
.query-progress-panel .progress-bar-success {
  background: var(--blue);
}
.query-progress-panel .progress-bar-failure {
  background: #d69e2e;
}
.progress-counts {
  gap: 0;
}
.progress-counts > :not(.d-none) ~ :not(.d-none)::before {
  content: "\00b7";
  margin: 0 7px;
  color: #94a3b8;
  font-weight: 400;
}
.progress-result-primary {
  margin: 8px 0 0;
  color: #1f2937;
  font-size: .9rem;
  font-weight: 650;
}
.progress-result-secondary {
  margin: 2px 0 0;
  color: #64748b;
  font-size: .79rem;
  line-height: 1.35;
}
.progress-current,
.progress-message {
  margin-top: 6px;
  margin-bottom: 0;
}
.progress-idle-message {
  color: #64748b;
  font-size: .84rem;
  line-height: 1.4;
}
.progress-idle-message > :last-child {
  margin-bottom: 0;
}
.progress-failure-details {
  margin-top: 7px;
  border-top: 1px solid rgb(100 116 139 / 20%);
  padding-top: 6px;
  color: #475569;
  font-size: .8rem;
}
.progress-failure-details summary {
  width: fit-content;
  cursor: pointer;
  color: #8a4b08;
  font-weight: 650;
}
.progress-failure-details summary:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.progress-failure-item {
  display: grid;
  gap: 1px;
  margin-top: 6px;
  border-left: 2px solid #d69e2e;
  padding-left: 7px;
}
.progress-failure-item > span {
  color: #64748b;
}
.progress-failure-item > p {
  margin: 2px 0 0;
}
.query-progress-panel.progress-partial {
  border-color: #d9ad55;
  background: #fffaf0;
}
.query-progress-panel.progress-partial .progress-failed {
  color: #8a4b08;
}
.query-progress-panel.progress-complete .progress-bar-success {
  background: #2f855a;
}
.query-progress-panel.progress-error .progress-bar-failure {
  background: #c53030;
}
.query-progress-panel.progress-error .progress-failure-details summary {
  color: #a61b1b;
}
/* Centered workflow redesign */
.workflow-container {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto 32px;
}
.workflow-card,
.query-progress-panel {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 18px;
  border: 1px solid #e1e7ee;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(23, 54, 93, .07);
}
.workflow-card {
  padding: 22px 24px;
}
.workflow-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.workflow-card-heading .section-heading {
  margin: 0;
  color: #13243d;
  font-weight: 650;
}
.step-number {
  display: inline-flex;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #1473cc;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}
.dataset-primary-grid {
  display: grid;
  grid-template-columns: 1.35fr .78fr .78fr 1.25fr;
  gap: 18px 24px;
  align-items: start;
}
.dataset-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 24px;
  margin-top: 2px;
}
.dataset-primary-grid .shiny-input-container,
.dataset-filter-grid .shiny-input-container,
.indicator-controls .shiny-input-container,
.locations-grid .shiny-input-container {
  width: 100%;
  margin-bottom: 12px;
}
.dataset-product-field .shiny-options-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.dataset-product-field .form-check {
  margin: 0;
}
.filter-field:empty {
  display: none;
}
.helper-callout {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 11px;
  border: 1px solid #cfe2f5;
  border-radius: 7px;
  background: #f2f8fe;
  color: #3f5f7e;
  font-size: .86rem;
}
.helper-icon {
  display: inline-flex;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid #1473cc;
  border-radius: 50%;
  color: #1473cc;
  font-size: .72rem;
  font-weight: 750;
}
.locations-grid {
  display: grid;
  grid-template-columns: minmax(250px, .9fr) minmax(0, 1.45fr);
  gap: 28px;
  align-items: start;
}
.location-selection-summary {
  border-right: 1px solid #e2e8f0;
  padding-right: 28px;
}
.selected-panel {
  min-height: 126px;
  margin: 14px 0 0;
}
.selected-jurisdictions-list {
  max-height: 190px;
}
.jurisdiction-picker .selectize-input {
  min-height: 42px;
}
.jurisdiction-picker .selectize-dropdown-content {
  max-height: 260px;
}
.indicator-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}
.indicator-search {
  flex: 1 1 380px;
  max-width: 520px;
}
.indicator-toolbar {
  flex: 0 1 auto;
  justify-content: flex-end;
  padding-bottom: 12px;
}
#indicator_accordion {
  overflow: hidden;
  border: 1px solid #dbe3ec;
  border-radius: 7px;
}
#indicator_accordion .accordion-item {
  border-right: 0;
  border-left: 0;
}
#indicator_accordion .accordion-button {
  padding: 10px 14px;
  background: #f8fafc;
}
.indicator-table > thead > tr > th {
  padding-top: 7px;
  padding-bottom: 7px;
  color: #526276;
  font-size: .8rem;
}
.indicator-table > tbody > .indicator-row > td {
  padding-top: 4px;
  padding-bottom: 4px;
}
.indicator-table th:not(:first-child),
.indicator-table td:not(:first-child) {
  width: 88px;
}
.run-query-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.run-query-row .btn {
  min-width: 170px;
}
.query-progress-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, .9fr);
  gap: 16px 26px;
  margin-top: 0;
  padding: 18px 20px;
}
.query-progress-panel::before {
  content: "";
  align-self: start;
  grid-column: 1 / -1;
  width: 0;
  height: 0;
}
.progress-main {
  min-width: 0;
}
.query-progress-panel .progress-heading {
  margin-bottom: 10px;
}
#query-progress-title {
  color: #172b45;
  font-size: 1rem;
}
.query-progress-panel .progress {
  height: 9px;
  margin-bottom: 8px;
}
.progress-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(62px, 1fr));
  align-self: center;
  gap: 0;
}
.status-metric {
  display: flex;
  min-height: 52px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #e1e7ee;
  text-align: center;
}
.status-metric > span {
  color: #172b45;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
}
.status-metric > small {
  margin-top: 5px;
  color: #64748b;
  font-size: .75rem;
}
.status-metric-completed > small { color: #2f855a; }
.status-metric-warnings > span,
.status-metric-warnings > small { color: #a15c08; }
.status-metric-failed > span,
.status-metric-failed > small { color: #b42318; }
.progress-counts > :not(.d-none) ~ :not(.d-none)::before {
  content: none;
}
.query-progress-panel .progress-failure-details,
.query-progress-panel .progress-idle-message {
  grid-column: 1 / -1;
  margin-top: 0;
}
.query-progress-panel.progress-partial {
  border-color: #edca7a;
  background: #fffbf2;
}
.query-progress-panel.progress-error {
  border-color: #e3a3a3;
  background: #fff7f7;
}
.automatic-download {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .dataset-primary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .locations-grid,
  .query-progress-panel {
    grid-template-columns: 1fr;
  }
  .location-selection-summary {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    padding-right: 0;
    padding-bottom: 20px;
  }
  .indicator-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
  }
  .indicator-search {
    max-width: none;
  }
  .indicator-toolbar {
    justify-content: flex-start;
    padding-bottom: 8px;
  }
}

@media (max-width: 640px) {
  .workflow-container {
    width: min(100% - 20px, 1200px);
  }
  .workflow-card {
    padding: 18px 16px;
  }
  .dataset-primary-grid,
  .dataset-filter-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .dataset-product-field .shiny-options-group {
    display: block;
  }
  .section-heading {
    font-size: 1.3rem;
  }
  .progress-counts {
    grid-template-columns: repeat(2, minmax(80px, 1fr));
    row-gap: 10px;
  }
  .status-metric:nth-child(odd) {
    border-left: 0;
  }
  .indicator-table th:not(:first-child),
  .indicator-table td:not(:first-child) {
    width: 70px;
  }
  .run-query-row .btn {
    width: 100%;
  }
}


