/* Page-specific controls: Operations Home has the overview strip; list pages
   own their compact search and alphabetical order. */

body:not(.ec-operations-summary-active) .toolbar2 {
  display: none !important;
}

/* Operations Home combines its page identity, command controls and account
   actions into one calm control bar. The toolbar is moved into the header by
   the companion script only while this view is active. */
body.ec-operations-summary-active #dashboard-shell .topbar {
  min-height: 52px !important;
  height: 52px !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px !important;
  padding: 5px 8px !important;
  overflow: hidden;
  border-radius: 12px !important;
}

body.ec-operations-summary-active #dashboard-shell .topbar-left {
  min-width: 0;
  flex: 0 0 auto;
  gap: 6px !important;
  overflow: visible;
}

body.ec-operations-summary-active #dashboard-shell .topbar-title { gap: 0; }
body.ec-operations-summary-active #dashboard-shell .page-title {
  font-size: 14px !important;
  line-height: 1 !important;
  letter-spacing: -.02em;
}
body.ec-operations-summary-active #dashboard-shell .breadcrumbs { display: none !important; }

body.ec-operations-summary-active #dashboard-shell .topbar > .toolbar2.ec-operations-commandline {
  display: flex !important;
  width: auto !important;
  min-width: 0;
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 6px !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2-left {
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 .search2 {
  flex-basis: 150px;
  width: 150px;
  min-width: 150px;
  height: 30px;
}

body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 .filters2 select {
  min-width: 68px !important;
  width: 72px;
  max-width: 86px;
}

body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 .kpi-mini {
  padding: 3px 5px !important;
  gap: 3px !important;
}

body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 .kpi-mini-ic { font-size: 13px !important; }
body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 .kpi-mini-label { font-size: 8px !important; }
body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 .kpi-mini-value { font-size: 10px !important; }

body.ec-operations-summary-active #dashboard-shell .topbar-right {
  width: auto !important;
  min-width: 0;
  flex: 0 0 auto;
  gap: 5px !important;
  flex-wrap: nowrap !important;
}

body.ec-operations-summary-active #dashboard-shell .topbar-chip {
  height: 30px !important;
  padding: 0 6px !important;
  gap: 4px !important;
  border-radius: 9px !important;
}

body.ec-operations-summary-active #dashboard-shell .topbar-chip .material-icons-outlined { font-size: 15px !important; }
body.ec-operations-summary-active #dashboard-shell .chip-select { font-size: 10px !important; }

body.ec-operations-summary-active #dashboard-shell .topbar-actions { gap: 4px !important; }
body.ec-operations-summary-active #dashboard-shell .topbar-actions .icon-btn {
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 8px !important;
}
body.ec-operations-summary-active #dashboard-shell .topbar-actions .material-icons-outlined { font-size: 15px !important; }

body.ec-operations-summary-active #dashboard-shell .profile-chip {
  max-width: 132px;
  height: 30px;
  padding: 2px 7px 2px 3px;
  gap: 5px;
  border-radius: 9px !important;
  font-size: 10px;
  overflow: hidden;
}
body.ec-operations-summary-active #dashboard-shell #profile-avatar {
  width: 22px !important;
  height: 22px !important;
}
body.ec-operations-summary-active #dashboard-shell #profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The Operations Home summary is a command line, not a second header. Keep
   every control on one quiet, compact row directly above the map. */
body.ec-operations-summary-active .toolbar2 {
  min-height: 42px !important;
  height: 42px !important;
  margin-top: 7px !important;
  padding: 4px 8px !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  overflow: hidden;
  border-radius: 12px !important;
}

body.ec-operations-summary-active #dashboard-shell .toolbar2-left {
  display: flex !important;
  width: auto !important;
  min-width: 0;
  flex: 1 1 auto;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  grid-template-columns: none !important;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

body.ec-operations-summary-active .toolbar2-left::-webkit-scrollbar { display: none; }

body.ec-operations-summary-active #dashboard-shell .toolbar2-right {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto;
  gap: 5px !important;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

body.ec-operations-summary-active .toolbar2 .search2 {
  flex: 0 0 176px;
  width: 176px;
  min-width: 176px;
  height: 30px;
  padding: 3px 7px;
  border-radius: 9px !important;
}

body.ec-operations-summary-active .toolbar2 .search2 .material-icons-outlined {
  font-size: 16px;
}

body.ec-operations-summary-active .toolbar2 .search2 .icon-btn {
  width: 22px !important;
  min-width: 22px !important;
  height: 22px !important;
}

body.ec-operations-summary-active #dashboard-shell .toolbar2 .filters2 {
  display: inline-flex !important;
  width: auto !important;
  gap: 4px !important;
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
  flex-wrap: nowrap !important;
  grid-template-columns: none !important;
  grid-column: auto !important;
}

body.ec-operations-summary-active #dashboard-shell .toolbar2 .filters2 select {
  min-width: 76px !important;
  width: 88px;
  max-width: 104px;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 24px 0 7px !important;
  border-radius: 9px !important;
  font-size: 10px !important;
}

body.ec-operations-summary-active #dashboard-shell .toolbar2 .kpi-strip {
  display: inline-flex !important;
  width: auto !important;
  align-items: center;
  gap: 4px !important;
  flex: 0 0 auto;
  white-space: nowrap;
  grid-template-columns: none !important;
  grid-column: auto !important;
}

body.ec-operations-summary-active #dashboard-shell .toolbar2 .kpi-mini {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 3px 6px !important;
  gap: 4px !important;
  border-radius: 9px !important;
  box-shadow: none !important;
}

body.ec-operations-summary-active .toolbar2 .kpi-mini-ic { font-size: 14px !important; }

body.ec-operations-summary-active .toolbar2 .kpi-mini-text {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}

body.ec-operations-summary-active .toolbar2 .kpi-mini-label {
  font-size: 9px !important;
  line-height: 1 !important;
}

body.ec-operations-summary-active .toolbar2 .kpi-mini-value {
  font-size: 11px !important;
  line-height: 1 !important;
}

body.ec-operations-summary-active .toolbar2 .kpi-mini-trend { display: none !important; }

body.ec-operations-summary-active .toolbar2 .btn {
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 8px !important;
  border-radius: 9px !important;
  font-size: 10px !important;
}

body.ec-operations-summary-active .toolbar2 .btn .material-icons-outlined { font-size: 15px; }

@media (max-width: 1180px) {
  body.ec-operations-summary-active .toolbar2 .kpi-mini[data-access="super_admin"] { display: none !important; }
}

@media (max-width: 820px) {
  body.ec-operations-summary-active .toolbar2 {
    height: 40px !important;
    min-height: 40px !important;
  }

  body.ec-operations-summary-active .toolbar2 .search2 {
    flex-basis: 148px;
    width: 148px;
    min-width: 148px;
  }

  body.ec-operations-summary-active .toolbar2 .toolbar2-right .btn span:last-child { display: none; }
  body.ec-operations-summary-active .toolbar2 .toolbar2-right .btn { width: 30px; padding: 0 !important; }
}

@media (max-width: 1360px) {
  body.ec-operations-summary-active #dashboard-shell .profile-chip { width: 30px; padding-right: 3px; }
  body.ec-operations-summary-active #dashboard-shell #profile-name { display: none; }
}

@media (max-width: 680px) {
  body.ec-operations-summary-active #dashboard-shell .topbar {
    height: auto !important;
    min-height: 84px !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 34px 32px;
  }

  body.ec-operations-summary-active #dashboard-shell .topbar-left { grid-column: 1; grid-row: 1; }
  body.ec-operations-summary-active #dashboard-shell .topbar-right { grid-column: 2; grid-row: 1; }
  body.ec-operations-summary-active #dashboard-shell .topbar > .toolbar2.ec-operations-commandline {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.ec-operations-summary-active #dashboard-shell .topbar-chip .material-icons-outlined { display: none; }
  body.ec-operations-summary-active #dashboard-shell .topbar-chip { padding: 0 4px !important; }
}

@media (max-width: 1100px) {
  body.ec-operations-summary-active #dashboard-shell .profile-chip { display: none; }
  body.ec-operations-summary-active #dashboard-shell .topbar-chip { display: none; }

  /* Map Home needs a clear command bar at tablet widths. Detailed list
     filtering remains available within each workspace, so only summary-only
     signals are condensed here. */
  body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 #category-filter,
  body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 #global-sort,
  body.ec-operations-summary-active #dashboard-shell .topbar .toolbar2 .kpi-strip {
    display: none !important;
  }
}

.ec-context-list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
}

.ec-context-search {
  width: min(340px, 100%);
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.ec-context-search .material-icons-outlined {
  color: var(--muted);
  font-size: 17px;
}

.ec-context-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  font-size: 11px;
  font-weight: 800;
}

.ec-context-alpha {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .02em;
  white-space: nowrap;
}

#programs-view .ecw-program-search {
  margin-left: auto;
}

@media (max-width: 700px) {
  .ec-context-list-tools { align-items: stretch; }
  .ec-context-search { width: 100%; }
  .ec-context-alpha { align-self: center; }
}
